Compare commits
58 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd09e24cf0 | ||
|
|
2a11891988 | ||
|
|
e7d90c3a73 | ||
|
|
72b1f39814 | ||
|
|
38028b5cb0 | ||
|
|
409999b37b | ||
|
|
0fc7b528d4 | ||
|
|
06764c073a | ||
|
|
26ff8087c6 | ||
|
|
83e57c92b4 | ||
|
|
a9245abb5c | ||
|
|
7a7c584217 | ||
|
|
bf3d033f39 | ||
|
|
42ce7aec5a | ||
|
|
17589e30da | ||
|
|
eb38fdd601 | ||
|
|
454d612a32 | ||
|
|
4dde761784 | ||
| 5f4f75d9dd | |||
|
|
cf7e5fa991 | ||
|
|
4f0dc512e2 | ||
|
|
a77b153ac8 | ||
|
|
dbb6a9f72b | ||
| 9567fe1295 | |||
|
|
a52021572a | ||
| d69a6e1e5d | |||
| a67535abbf | |||
|
|
dffc735edb | ||
|
|
38806367b4 | ||
|
|
6f770aa91d | ||
| dc32cc3bb7 | |||
|
|
d64d18f330 | ||
|
|
909f43e257 | ||
| 92aa66436e | |||
| 264f33302f | |||
|
|
7b9f5302d0 | ||
|
|
72d836020b | ||
|
|
67efef738a | ||
| 6918611d06 | |||
| 9f5b2ecc46 | |||
|
|
d30b8247cf | ||
| 0b61c4b7ba | |||
|
|
ff2b9db7b8 | ||
|
|
289900f9ff | ||
|
|
e87d05c587 | ||
| 46c55d48ec | |||
| b36f765d07 | |||
|
|
0fe2d2b911 | ||
|
|
8c41a8fc77 | ||
|
|
c779bec0cb | ||
|
|
5443996fa9 | ||
|
|
dac950c4c1 | ||
|
|
a19cbf233e | ||
|
|
028fd44490 | ||
|
|
0a52d1afae | ||
|
|
e655611954 | ||
|
|
b982cee382 | ||
|
|
d6336f7ba8 |
5
.env.hainan
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
NODE_ENV = hainan
|
||||||
|
VITE_NAME="hainan"
|
||||||
|
# 电网一张图 地图图层
|
||||||
|
VITE_NARIMAP=null
|
||||||
|
VITE_NRGISCOMMON=null
|
||||||
8813
package-lock.json
generated
Normal file
@@ -6,9 +6,11 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite --mode dev",
|
"dev": "vite --mode dev",
|
||||||
"dev:jibei": "vite --mode jibei",
|
"dev:jibei": "vite --mode jibei",
|
||||||
|
"dev:hainan": "vite --mode hainan",
|
||||||
"dev:removeMode": "vite --mode removeMode",
|
"dev:removeMode": "vite --mode removeMode",
|
||||||
"build": "vite build --mode dev",
|
"build": "vite build --mode dev",
|
||||||
"build:jibei": "vite build --mode jibei",
|
"build:jibei": "vite build --mode jibei",
|
||||||
|
"build:hainan": "vite build --mode hainan",
|
||||||
"build:removeMode": "vite build --mode removeMode",
|
"build:removeMode": "vite build --mode removeMode",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
@@ -19,7 +21,7 @@
|
|||||||
"@form-create/element-ui": "^3.1.24",
|
"@form-create/element-ui": "^3.1.24",
|
||||||
"@fortawesome/fontawesome-free": "^6.5.1",
|
"@fortawesome/fontawesome-free": "^6.5.1",
|
||||||
"@kjgl77/datav-vue3": "^1.7.4",
|
"@kjgl77/datav-vue3": "^1.7.4",
|
||||||
"@vue-office/docx": "^1.6.2",
|
"@vue-office/docx": "^1.6.3",
|
||||||
"@vue-office/excel": "^1.7.8",
|
"@vue-office/excel": "^1.7.8",
|
||||||
"@vue-office/pdf": "^2.0.2",
|
"@vue-office/pdf": "^2.0.2",
|
||||||
"@vueuse/core": "^10.7.0",
|
"@vueuse/core": "^10.7.0",
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 6.6 KiB |
BIN
public/favicon3.ico
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
public/favicon4.ico
Normal file
|
After Width: | Height: | Size: 19 KiB |
@@ -134,6 +134,22 @@ export function selectUserList(data: any) {
|
|||||||
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({
|
||||||
|
|||||||
@@ -1,32 +1,47 @@
|
|||||||
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'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -165,3 +165,20 @@ 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 })
|
||||||
|
}
|
||||||
|
|||||||
119
src/api/harmonic-boot/cockpit/cockpit.ts
Normal 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
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -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',
|
||||||
|
|||||||
@@ -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
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -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({
|
||||||
|
|||||||
@@ -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"></span>
|
||||||
|
<div class="name">253_ipower</div>
|
||||||
|
<div class="code-name">&#xe782;</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dib">
|
||||||
|
<span class="icon iconfont"></span>
|
||||||
|
<div class="name">电压</div>
|
||||||
|
<div class="code-name">&#xe665;</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dib">
|
||||||
|
<span class="icon iconfont"></span>
|
||||||
|
<div class="name">三相电压幅值不平衡</div>
|
||||||
|
<div class="code-name">&#xe758;</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dib">
|
||||||
|
<span class="icon iconfont"></span>
|
||||||
|
<div class="name">电压总谐波畸变率</div>
|
||||||
|
<div class="code-name">&#xe61e;</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dib">
|
||||||
|
<span class="icon iconfont"></span>
|
||||||
|
<div class="name">闪变</div>
|
||||||
|
<div class="code-name">&#xe612;</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dib">
|
||||||
|
<span class="icon iconfont"></span>
|
||||||
|
<div class="name">停运事件管理</div>
|
||||||
|
<div class="code-name">&#xe65d;</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dib">
|
||||||
|
<span class="icon iconfont"></span>
|
||||||
|
<div class="name">在运设备</div>
|
||||||
|
<div class="code-name">&#xe604;</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dib">
|
||||||
|
<span class="icon iconfont"></span>
|
||||||
|
<div class="name">异常类_14非智能表在运异常</div>
|
||||||
|
<div class="code-name">&#xe666;</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li class="dib">
|
<li class="dib">
|
||||||
<span class="icon iconfont"></span>
|
<span class="icon iconfont"></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>
|
||||||
|
|||||||
@@ -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";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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": "综合评价",
|
||||||
|
|||||||
BIN
src/assets/img/amplify.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
src/assets/img/inlogo.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
src/assets/img/lightning.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
src/assets/img/reduce.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
295
src/assets/img/view.vue
Normal 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>
|
||||||
@@ -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,35 @@ 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 = 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>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -279,6 +279,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 +337,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 +353,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 +391,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 +683,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%);
|
||||||
|
|||||||
@@ -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">
|
||||||
<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">
|
||||||
<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">
|
||||||
<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">
|
||||||
<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">
|
||||||
<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>
|
||||||
|
|||||||
517
src/components/cockpit/dataCleaning/index.vue
Normal file
@@ -0,0 +1,517 @@
|
|||||||
|
<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 }
|
||||||
|
})
|
||||||
|
|
||||||
|
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.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;
|
||||||
|
.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>
|
||||||
499
src/components/cockpit/integrity/index.vue
Normal file
@@ -0,0 +1,499 @@
|
|||||||
|
<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 }
|
||||||
|
})
|
||||||
|
|
||||||
|
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 != '上送国网' && k.citName != '非上送国网'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
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: '#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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
provide('tableStore', tableStore)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
echart()
|
||||||
|
}, 100)
|
||||||
|
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;
|
||||||
|
.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>
|
||||||
498
src/components/cockpit/onlineRate/index.vue
Normal file
@@ -0,0 +1,498 @@
|
|||||||
|
<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 }
|
||||||
|
})
|
||||||
|
|
||||||
|
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 != '上送国网' && k.citName != '非上送国网'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
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: '#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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
provide('tableStore', tableStore)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
echart()
|
||||||
|
}, 100)
|
||||||
|
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;
|
||||||
|
.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>
|
||||||
476
src/components/cockpit/terminalEvaluation/index.vue
Normal file
@@ -0,0 +1,476 @@
|
|||||||
|
<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 }
|
||||||
|
})
|
||||||
|
|
||||||
|
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 != '上送国网' && k.name != '非上送国网'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
tableStore.table.params.deptIndex = dictData.state.area[0].id
|
||||||
|
tableStore.table.params.lineRunFlag = 0
|
||||||
|
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>
|
||||||
|
@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>
|
||||||
450
src/components/cockpit/terminalEvaluation/index1.vue
Normal 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>
|
||||||
@@ -15,7 +15,7 @@ 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>()
|
||||||
|
|
||||||
@@ -153,6 +153,9 @@ 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)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -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']
|
||||||
|
|||||||
@@ -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>
|
|
||||||
@@ -1,190 +1,190 @@
|
|||||||
<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-button v-if="view2 && senior" class="ml10" type="primary"
|
||||||
@click="AdvancedAnalytics">高级分析</el-button> -->
|
@click="AdvancedAnalytics">高级分析</el-button> -->
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-button
|
<el-button
|
||||||
@click="backbxlb"
|
@click="backbxlb"
|
||||||
class="el-icon-refresh-right"
|
class="el-icon-refresh-right"
|
||||||
icon="el-icon-CloseBold"
|
icon="el-icon-Back"
|
||||||
style="float: right"
|
style="float: right"
|
||||||
>
|
>
|
||||||
返回
|
返回
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<div v-loading="loading" style="height: calc(100vh - 190px)">
|
<div v-loading="loading" style="height: calc(100vh - 190px)">
|
||||||
<el-tabs v-if="view4" class="default-main" v-model="bxactiveName" @tab-click="bxhandleClick">
|
<el-tabs v-if="view4" class="default-main" v-model="bxactiveName" @tab-click="bxhandleClick">
|
||||||
<el-tab-pane
|
<el-tab-pane
|
||||||
label="瞬时波形"
|
label="瞬时波形"
|
||||||
name="ssbx"
|
name="ssbx"
|
||||||
class="boxbx pt10 pb10"
|
class="boxbx pt10 pb10"
|
||||||
:style="'height:' + bxecharts + ';overflow-y: scroll;'"
|
:style="'height:' + bxecharts + ';overflow-y: scroll;'"
|
||||||
>
|
>
|
||||||
<shushiboxi
|
<shushiboxi
|
||||||
ref="shushiboxiRef"
|
ref="shushiboxiRef"
|
||||||
v-if="bxactiveName == 'ssbx' && showBoxi"
|
v-if="bxactiveName == 'ssbx' && showBoxi"
|
||||||
:value="value"
|
:value="value"
|
||||||
:parentHeight="parentHeight"
|
:parentHeight="parentHeight"
|
||||||
:boxoList="boxoList"
|
:boxoList="boxoList"
|
||||||
:wp="wp"
|
:wp="wp"
|
||||||
></shushiboxi>
|
></shushiboxi>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane
|
<el-tab-pane
|
||||||
label="RMS波形"
|
label="RMS波形"
|
||||||
class="boxbx pt10 pb10"
|
class="boxbx pt10 pb10"
|
||||||
name="rmsbx"
|
name="rmsbx"
|
||||||
:style="'height:' + bxecharts + ';overflow-y: scroll;'"
|
:style="'height:' + bxecharts + ';overflow-y: scroll;'"
|
||||||
>
|
>
|
||||||
<rmsboxi
|
<rmsboxi
|
||||||
ref="rmsboxiRef"
|
ref="rmsboxiRef"
|
||||||
v-if="bxactiveName == 'rmsbx' && showBoxi"
|
v-if="bxactiveName == 'rmsbx' && showBoxi"
|
||||||
:value="value"
|
:value="value"
|
||||||
:parentHeight="parentHeight"
|
:parentHeight="parentHeight"
|
||||||
:boxoList="boxoList"
|
:boxoList="boxoList"
|
||||||
:wp="wp"
|
:wp="wp"
|
||||||
></rmsboxi>
|
></rmsboxi>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<el-empty v-else description="暂无数据" style="height: calc(100vh - 190px)" />
|
<el-empty v-else description="暂无数据" style="height: calc(100vh - 190px)" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="view3" class="pd10">
|
<div v-if="view3" class="pd10">
|
||||||
<span style="font-weight: 500; font-size: 22px">高级分析</span>
|
<span style="font-weight: 500; font-size: 22px">高级分析</span>
|
||||||
<el-button icon="el-icon-Back" @click="gaoBack" style="float: right">返回</el-button>
|
<el-button icon="el-icon-Back" @click="gaoBack" style="float: right">返回</el-button>
|
||||||
<analytics :flag="true" :GJList="GJList" :boxoList="boxoList"></analytics>
|
<analytics :flag="true" :GJList="GJList" :boxoList="boxoList"></analytics>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import shushiboxi from '@/components/echarts/shushiboxi.vue'
|
import shushiboxi from '@/components/echarts/shushiboxi.vue'
|
||||||
import rmsboxi from '@/components/echarts/rmsboxi.vue'
|
import rmsboxi from '@/components/echarts/rmsboxi.vue'
|
||||||
import analytics from '@/components/echarts/analytics.vue'
|
import analytics from '@/components/echarts/analytics.vue'
|
||||||
import { ref, reactive } from 'vue'
|
import { ref, reactive } from 'vue'
|
||||||
import { analysis } from '@/api/advance-boot/analyse'
|
import { analysis } from '@/api/advance-boot/analyse'
|
||||||
import { mainHeight } from '@/utils/layout'
|
import { mainHeight } from '@/utils/layout'
|
||||||
import { getMonitorEventAnalyseWave, downloadWaveFile } from '@/api/event-boot/transient'
|
import { getMonitorEventAnalyseWave, downloadWaveFile } from '@/api/event-boot/transient'
|
||||||
const emit = defineEmits(['backbxlb'])
|
const emit = defineEmits(['backbxlb'])
|
||||||
interface Props {
|
interface Props {
|
||||||
// boxoList: any
|
// boxoList: any
|
||||||
// wp: any,
|
// wp: any,
|
||||||
senior?: boolean
|
senior?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
senior: false
|
senior: false
|
||||||
})
|
})
|
||||||
const parentHeight = ref(0)
|
const parentHeight = ref(0)
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const bxactiveName = ref('ssbx')
|
const bxactiveName = ref('ssbx')
|
||||||
const rmsboxiRef = ref()
|
const rmsboxiRef = ref()
|
||||||
const value = ref(1)
|
const value = ref(1)
|
||||||
const options = ref([
|
const options = ref([
|
||||||
{
|
{
|
||||||
value: 1,
|
value: 1,
|
||||||
label: '一次值'
|
label: '一次值'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 2,
|
value: 2,
|
||||||
label: '二次值'
|
label: '二次值'
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
const shushiboxiRef = ref()
|
const shushiboxiRef = ref()
|
||||||
const bxecharts = ref(mainHeight(95).height as any)
|
const bxecharts = ref(mainHeight(95).height as any)
|
||||||
const view2 = ref(true)
|
const view2 = ref(true)
|
||||||
const boxoList = ref(null)
|
const boxoList = ref(null)
|
||||||
const wp = ref(null)
|
const wp = ref(null)
|
||||||
const showBoxi = ref(true)
|
const showBoxi = ref(true)
|
||||||
const view3 = ref(false)
|
const view3 = ref(false)
|
||||||
const view4 = ref(false)
|
const view4 = ref(false)
|
||||||
const GJList = ref([])
|
const GJList = ref([])
|
||||||
|
|
||||||
const open = async (row: any) => {
|
const open = async (row: any) => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
await getMonitorEventAnalyseWave({ id: row.eventId, systemType: 0 })
|
await getMonitorEventAnalyseWave({ id: row.eventId, systemType: 0 })
|
||||||
.then(res => {
|
.then(res => {
|
||||||
row.loading = false
|
row.loading = false
|
||||||
if (res != undefined) {
|
if (res != undefined) {
|
||||||
boxoList.value = row
|
boxoList.value = row
|
||||||
wp.value = res.data
|
wp.value = res.data
|
||||||
loading.value = false
|
loading.value = false
|
||||||
view4.value = true
|
view4.value = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const bxhandleClick = (tab: any) => {
|
const bxhandleClick = (tab: any) => {
|
||||||
if (shushiboxiRef.value) shushiboxiRef.value.backbxlb()
|
if (shushiboxiRef.value) shushiboxiRef.value.backbxlb()
|
||||||
if (rmsboxiRef.value) rmsboxiRef.value.backbxlb()
|
if (rmsboxiRef.value) rmsboxiRef.value.backbxlb()
|
||||||
|
|
||||||
loading.value = true
|
loading.value = true
|
||||||
if (tab.name == 'ssbx') {
|
if (tab.name == 'ssbx') {
|
||||||
bxactiveName.value = 'ssbx'
|
bxactiveName.value = 'ssbx'
|
||||||
} else if (tab.name == 'rmsbx') {
|
} else if (tab.name == 'rmsbx') {
|
||||||
bxactiveName.value = 'rmsbx'
|
bxactiveName.value = 'rmsbx'
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}, 0)
|
}, 0)
|
||||||
// console.log(tab, event);
|
// console.log(tab, event);
|
||||||
}
|
}
|
||||||
const backbxlb = () => {
|
const backbxlb = () => {
|
||||||
boxoList.value = null
|
boxoList.value = null
|
||||||
wp.value = null
|
wp.value = null
|
||||||
if (shushiboxiRef.value) shushiboxiRef.value.backbxlb()
|
if (shushiboxiRef.value) shushiboxiRef.value.backbxlb()
|
||||||
if (rmsboxiRef.value) rmsboxiRef.value.backbxlb()
|
if (rmsboxiRef.value) rmsboxiRef.value.backbxlb()
|
||||||
|
|
||||||
emit('backbxlb')
|
emit('backbxlb')
|
||||||
}
|
}
|
||||||
const setHeight = (h: any, vh: any) => {
|
const setHeight = (h: any, vh: any) => {
|
||||||
if (h != false) {
|
if (h != false) {
|
||||||
parentHeight.value = h
|
parentHeight.value = h
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
bxecharts.value = mainHeight(vh).height
|
bxecharts.value = mainHeight(vh).height
|
||||||
}, 100)
|
}, 100)
|
||||||
}
|
}
|
||||||
// 高级分析
|
// 高级分析
|
||||||
const AdvancedAnalytics = () => {
|
const AdvancedAnalytics = () => {
|
||||||
analysis({
|
analysis({
|
||||||
eventIndex: boxoList.value.eventId
|
eventIndex: boxoList.value.eventId
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
GJList.value = res.data
|
GJList.value = res.data
|
||||||
view3.value = true
|
view3.value = true
|
||||||
view2.value = false
|
view2.value = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const changeView = () => {
|
const changeView = () => {
|
||||||
if (shushiboxiRef.value) shushiboxiRef.value.backbxlb()
|
if (shushiboxiRef.value) shushiboxiRef.value.backbxlb()
|
||||||
if (rmsboxiRef.value) rmsboxiRef.value.backbxlb()
|
if (rmsboxiRef.value) rmsboxiRef.value.backbxlb()
|
||||||
showBoxi.value = false
|
showBoxi.value = false
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
showBoxi.value = true
|
showBoxi.value = true
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
const gaoBack = () => {
|
const gaoBack = () => {
|
||||||
view2.value = true
|
view2.value = true
|
||||||
view3.value = false
|
view3.value = false
|
||||||
}
|
}
|
||||||
defineExpose({ open, setHeight })
|
defineExpose({ open, setHeight })
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped></style>
|
||||||
|
|||||||
@@ -1,54 +1,54 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-if="isModal" size="50%" v-model="visibles" @cancel="cancel" v-bind="$attrs" :append-to-body="true">
|
<el-dialog v-if="isModal" size="50%" v-model="visibles" @cancel="cancel" v-bind="$attrs" :append-to-body="true">
|
||||||
<template v-for="slotKey in slotKeys" #[slotKey]>
|
<template v-for="slotKey in slotKeys" #[slotKey]>
|
||||||
<slot :name="slotKey" />
|
<slot :name="slotKey" />
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<el-drawer v-else size="50%" v-model="visibles" v-bind="$attrs" :append-to-body="true" :footer-style="{ textAlign: 'right' }">
|
<el-drawer v-else size="50%" v-model="visibles" v-bind="$attrs" :append-to-body="true" :footer-style="{ textAlign: 'right' }">
|
||||||
<template v-for="slotKey in slotKeys" #[slotKey]>
|
<template v-for="slotKey in slotKeys" #[slotKey]>
|
||||||
<slot :name="slotKey" />
|
<slot :name="slotKey" />
|
||||||
</template>
|
</template>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapState } from 'pinia'
|
import { mapState } from 'pinia'
|
||||||
import { globalStore } from '@/stores/indexs'
|
// import { globalStore } from '@/stores/indexs'
|
||||||
|
|
||||||
const FormContainerTypeEnum = {
|
const FormContainerTypeEnum = {
|
||||||
DRAWER: 'drawer',
|
DRAWER: 'drawer',
|
||||||
MODAL: 'modal'
|
MODAL: 'modal'
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
props: {
|
props: {
|
||||||
visible: {
|
visible: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(globalStore, ['formStyle']),
|
// ...mapState(globalStore, ['formStyle']),
|
||||||
slotKeys() {
|
slotKeys() {
|
||||||
return Object.keys(this.$slots)
|
return Object.keys(this.$slots)
|
||||||
},
|
},
|
||||||
isModal() {
|
isModal() {
|
||||||
return FormContainerTypeEnum.MODAL === this.formStyle
|
return FormContainerTypeEnum.MODAL === this.formStyle
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
visibles: ''
|
visibles: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
cancel() {
|
cancel() {
|
||||||
this.$emit('close')
|
this.$emit('close')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.visibles = this.visible
|
this.visibles = this.visible
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export const defaultAttribute: VxeTableProps = {
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
headerCellClassName: 'table-header-cell',
|
headerCellClassName: 'table-header-cell',
|
||||||
border: true,
|
border: true,
|
||||||
|
stripe: true,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
columnConfig: { resizable: true },
|
columnConfig: { resizable: true },
|
||||||
rowConfig: { isCurrent: true, isHover: true },
|
rowConfig: { isCurrent: true, isHover: true },
|
||||||
@@ -13,6 +13,7 @@ export const defaultAttribute: VxeTableProps = {
|
|||||||
treeConfig: {
|
treeConfig: {
|
||||||
reserve: true
|
reserve: true
|
||||||
},
|
},
|
||||||
|
showOverflow: true,
|
||||||
showOverflow: true
|
showFooter:true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,375 +1,399 @@
|
|||||||
<template>
|
<template>
|
||||||
<div ref="tableHeader" class="cn-table-header">
|
<div ref="tableHeader" class="cn-table-header">
|
||||||
<div class="table-header ba-scroll-style">
|
<div class="table-header ba-scroll-style">
|
||||||
<el-form
|
<el-form
|
||||||
style="flex: 1; height: 32px; display: flex; flex-wrap: wrap"
|
style="flex: 1; height: 32px; display: flex; flex-wrap: wrap"
|
||||||
ref="headerForm"
|
ref="headerForm"
|
||||||
@submit.prevent=""
|
@submit.prevent=""
|
||||||
@keyup.enter="onComSearch"
|
@keyup.enter="onComSearch"
|
||||||
label-position="left"
|
label-position="left"
|
||||||
:inline="true"
|
:inline="true"
|
||||||
>
|
>
|
||||||
<el-form-item v-if="datePicker" style="grid-column: span 2; max-width: 590px">
|
<el-form-item v-if="datePicker" style="grid-column: span 2; max-width: 630px">
|
||||||
<template #label>
|
<template #label>
|
||||||
<el-checkbox v-if="showTimeAll" v-model="timeAll" label="时间" />
|
<el-checkbox v-if="showTimeAll" v-model="timeAll" label="统计时间" />
|
||||||
<span v-else>时间</span>
|
<span v-else>{{ dateLabel }}</span>
|
||||||
</template>
|
</template>
|
||||||
<DatePicker
|
<DatePicker
|
||||||
ref="datePickerRef"
|
ref="datePickerRef"
|
||||||
v-if="timeAll"
|
v-if="timeAll"
|
||||||
:nextFlag="nextFlag"
|
:nextFlag="nextFlag"
|
||||||
:theCurrentTime="theCurrentTime"
|
:theCurrentTime="theCurrentTime"
|
||||||
></DatePicker>
|
></DatePicker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="区域" v-if="area">
|
<el-form-item label="区域" v-if="area">
|
||||||
<Area ref="areaRef" v-model="tableStore.table.params.deptIndex" />
|
<Area ref="areaRef" v-model="tableStore.table.params.deptIndex" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<slot name="select"></slot>
|
<slot name="select"></slot>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template v-if="$slots.select || datePicker || showSearch">
|
<template v-if="$slots.select || datePicker || showSearch">
|
||||||
<el-button type="primary" @click="showSelectChange" v-if="showUnfoldButton">
|
<el-button type="primary" @click="showSelectChange" v-if="showUnfoldButton">
|
||||||
<Icon size="14" name="el-icon-ArrowUp" style="color: #fff" v-if="showSelect" />
|
<Icon size="14" name="el-icon-ArrowUp" style="color: #fff" v-if="showSelect" />
|
||||||
<Icon size="14" name="el-icon-ArrowDown" style="color: #fff" v-else />
|
<Icon size="14" name="el-icon-ArrowDown" style="color: #fff" v-else />
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
@click="onComSearch"
|
@click="onComSearch"
|
||||||
v-if="showSearch"
|
v-if="showSearch"
|
||||||
:loading="tableStore.table.loading"
|
:loading="tableStore.table.loading"
|
||||||
type="primary"
|
type="primary"
|
||||||
:icon="Search"
|
:icon="Search"
|
||||||
>
|
>
|
||||||
查询
|
查询
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
@click="onResetForm"
|
@click="onResetForm"
|
||||||
v-if="showSearch && showReset"
|
v-if="showSearch && showReset"
|
||||||
:loading="tableStore.table.loading"
|
:loading="tableStore.table.loading"
|
||||||
:icon="RefreshLeft"
|
:icon="RefreshLeft"
|
||||||
>
|
>
|
||||||
重置
|
重置
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
@click="onExport"
|
@click="onExport"
|
||||||
v-if="showExport"
|
v-if="showExport"
|
||||||
:loading="tableStore.table.loading"
|
:loading="tableStore.table.loading"
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-Download"
|
icon="el-icon-Download"
|
||||||
>
|
>
|
||||||
导出
|
导出
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
<slot name="operation"></slot>
|
<slot name="operation"></slot>
|
||||||
</div>
|
</div>
|
||||||
<el-form
|
<el-form
|
||||||
:style="showSelect && showUnfoldButton ? headerFormSecondStyleOpen : headerFormSecondStyleClose"
|
:style="showSelect && showUnfoldButton ? headerFormSecondStyleOpen : headerFormSecondStyleClose"
|
||||||
ref="headerFormSecond"
|
ref="headerFormSecond"
|
||||||
@submit.prevent=""
|
@submit.prevent=""
|
||||||
@keyup.enter="onComSearch"
|
@keyup.enter="onComSearch"
|
||||||
label-position="left"
|
label-position="left"
|
||||||
:inline="true"
|
:inline="true"
|
||||||
></el-form>
|
></el-form>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { inject, ref, onMounted, nextTick, onUnmounted, watch } from 'vue'
|
import { inject, ref, onMounted, nextTick, onUnmounted, watch } from 'vue'
|
||||||
import type TableStore from '@/utils/tableStore'
|
import type TableStore from '@/utils/tableStore'
|
||||||
import DatePicker from '@/components/form/datePicker/index.vue'
|
import DatePicker from '@/components/form/datePicker/index.vue'
|
||||||
import Area from '@/components/form/area/index.vue'
|
import Area from '@/components/form/area/index.vue'
|
||||||
import { mainHeight } from '@/utils/layout'
|
import { mainHeight } from '@/utils/layout'
|
||||||
import { useDictData } from '@/stores/dictData'
|
import { useDictData } from '@/stores/dictData'
|
||||||
import { Search, RefreshLeft } from '@element-plus/icons-vue'
|
import { Search, RefreshLeft } from '@element-plus/icons-vue'
|
||||||
import { defineProps } from 'vue'
|
import { defineProps } from 'vue'
|
||||||
const emit = defineEmits(['selectChange'])
|
const emit = defineEmits(['selectChange'])
|
||||||
const tableStore = inject('tableStore') as TableStore
|
const tableStore = inject('tableStore') as TableStore
|
||||||
const tableHeader = ref()
|
const tableHeader = ref()
|
||||||
const datePickerRef = ref()
|
const datePickerRef = ref()
|
||||||
const dictData = useDictData()
|
const dictData = useDictData()
|
||||||
const areaRef = ref()
|
const areaRef = ref()
|
||||||
const headerForm = ref()
|
const headerForm = ref()
|
||||||
const headerFormSecond = ref()
|
const headerFormSecond = ref()
|
||||||
const timeAll = ref(true)
|
const timeAll = ref(true)
|
||||||
interface Props {
|
interface Props {
|
||||||
datePicker?: boolean
|
datePicker?: boolean
|
||||||
area?: boolean
|
area?: boolean
|
||||||
showSearch?: boolean
|
showSearch?: boolean
|
||||||
nextFlag?: boolean //控制时间是否可以往后推
|
nextFlag?: boolean //控制时间是否可以往后推
|
||||||
theCurrentTime?: boolean //控制时间前3天展示上个月时间
|
theCurrentTime?: boolean //控制时间前3天展示上个月时间
|
||||||
showReset?: boolean //是否显示重置按钮
|
showReset?: boolean //是否显示重置按钮
|
||||||
showExport?: boolean //导出控制
|
showExport?: boolean //导出控制
|
||||||
showTimeAll?: boolean //控制时间是否显示
|
showTimeAll?: boolean //控制时间是否显示
|
||||||
}
|
dateLabel?: string //设置时间名称
|
||||||
|
}
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
|
||||||
datePicker: false,
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
area: false,
|
datePicker: false,
|
||||||
showSearch: true,
|
area: false,
|
||||||
nextFlag: false,
|
showSearch: true,
|
||||||
theCurrentTime: false,
|
nextFlag: false,
|
||||||
showReset: true,
|
theCurrentTime: false,
|
||||||
showExport: false,
|
showReset: true,
|
||||||
showTimeAll: false
|
showExport: false,
|
||||||
})
|
showTimeAll: false,
|
||||||
// 动态计算table高度
|
dateLabel: '统计日期'
|
||||||
const resizeObserver = new ResizeObserver(entries => {
|
})
|
||||||
for (const entry of entries) {
|
// 动态计算table高度
|
||||||
handlerHeight()
|
const resizeObserver = new ResizeObserver(entries => {
|
||||||
computedSearchRow()
|
for (const entry of entries) {
|
||||||
}
|
handlerHeight()
|
||||||
})
|
computedSearchRow()
|
||||||
const showUnfoldButton = ref(false)
|
}
|
||||||
const headerFormSecondStyleOpen = {
|
})
|
||||||
opacity: 1,
|
const showUnfoldButton = ref(false)
|
||||||
height: 'auto',
|
const headerFormSecondStyleOpen = {
|
||||||
padding: '0 15px 13px 15px'
|
opacity: 1,
|
||||||
}
|
height: 'auto',
|
||||||
const headerFormSecondStyleClose = {
|
padding: '0 15px 13px 15px'
|
||||||
opacity: 0,
|
}
|
||||||
height: '0',
|
const headerFormSecondStyleClose = {
|
||||||
padding: '0'
|
opacity: 0,
|
||||||
}
|
height: '0',
|
||||||
|
padding: '0'
|
||||||
watch(
|
}
|
||||||
() => tableStore.table.params.deptIndex,
|
|
||||||
newVal => {
|
watch(
|
||||||
setTimeout(() => {
|
() => tableStore?.table.params.deptIndex,
|
||||||
areaRef.value && areaRef.value.change()
|
newVal => {
|
||||||
}, 0)
|
setTimeout(() => {
|
||||||
}
|
areaRef.value && areaRef.value.change()
|
||||||
)
|
}, 0)
|
||||||
watch(
|
}
|
||||||
() => timeAll.value,
|
)
|
||||||
newVal => {
|
watch(
|
||||||
tableStore.timeAll = newVal
|
() => timeAll.value,
|
||||||
setTimeout(() => {
|
newVal => {
|
||||||
computedSearchRow()
|
tableStore.timeAll = newVal
|
||||||
}, 500)
|
setTimeout(() => {
|
||||||
}
|
computedSearchRow()
|
||||||
)
|
}, 500)
|
||||||
onMounted(() => {
|
}
|
||||||
timeAll.value = props.showTimeAll ? false : true
|
)
|
||||||
if (props.datePicker && timeAll.value) {
|
onMounted(() => {
|
||||||
tableStore.table.params.searchBeginTime = datePickerRef.value.timeValue[0]
|
timeAll.value = props.showTimeAll ? false : true
|
||||||
tableStore.table.params.searchEndTime = datePickerRef.value.timeValue[1]
|
if (props.datePicker && timeAll.value) {
|
||||||
tableStore.table.params.startTime = datePickerRef.value.timeValue[0]
|
tableStore.table.params.searchBeginTime = datePickerRef.value.timeValue[0]
|
||||||
tableStore.table.params.endTime = datePickerRef.value.timeValue[1]
|
tableStore.table.params.searchEndTime = datePickerRef.value.timeValue[1]
|
||||||
tableStore.table.params.timeFlag = datePickerRef.value.timeFlag
|
tableStore.table.params.startTime = datePickerRef.value.timeValue[0]
|
||||||
tableStore.table.params.interval = datePickerRef.value.interval
|
tableStore.table.params.endTime = datePickerRef.value.timeValue[1]
|
||||||
}
|
tableStore.table.params.timeFlag = datePickerRef.value.timeFlag
|
||||||
if (props.area) {
|
tableStore.table.params.interval = datePickerRef.value.interval
|
||||||
tableStore.table.params.deptIndex = dictData.state.area[0].id
|
}
|
||||||
}
|
if (props.area) {
|
||||||
nextTick(() => {
|
tableStore.table.params.deptIndex = dictData.state.area[0].id
|
||||||
resizeObserver.observe(tableHeader.value)
|
}
|
||||||
setTimeout(() => {
|
nextTick(() => {
|
||||||
computedSearchRow()
|
resizeObserver.observe(tableHeader.value)
|
||||||
}, 500)
|
setTimeout(() => {
|
||||||
})
|
computedSearchRow()
|
||||||
})
|
}, 500)
|
||||||
onUnmounted(() => {
|
})
|
||||||
resizeObserver.disconnect()
|
})
|
||||||
})
|
onUnmounted(() => {
|
||||||
|
resizeObserver.disconnect()
|
||||||
const handlerHeight = () => {
|
})
|
||||||
tableStore.table.publicHeight + tableHeader.value.offsetHeight + (tableStore.showPage ? 58 : 0) + 20
|
|
||||||
tableStore.table.height = mainHeight(
|
const handlerHeight = () => {
|
||||||
tableStore.table.publicHeight + tableHeader.value.offsetHeight + (tableStore.showPage ? 58 : 0) + 20
|
if (tableStore && tableStore.table) {
|
||||||
).height as string
|
tableStore.table.publicHeight + tableHeader.value.offsetHeight + (tableStore.showPage ? 58 : 0) + 20
|
||||||
}
|
tableStore.table.height = mainHeight(
|
||||||
const computedSearchRow = () => {
|
tableStore.table.publicHeight + tableHeader.value.offsetHeight + (tableStore.showPage ? 58 : 0) + 20
|
||||||
if (!headerForm.value.$el) return
|
).height as string
|
||||||
// 清空headerFormSecond.value.$el下的元素
|
}
|
||||||
while (headerFormSecond.value.$el.firstChild) {
|
}
|
||||||
headerForm.value.$el.appendChild(headerFormSecond.value.$el.firstChild)
|
const computedSearchRow = () => {
|
||||||
}
|
if (!headerForm.value?.$el) return
|
||||||
// 获取第一行放了几个表单
|
// 清空headerFormSecond.value.$el下的元素
|
||||||
const elFormItem = headerForm.value.$el.querySelectorAll('.el-form-item')
|
while (headerFormSecond.value.$el.firstChild) {
|
||||||
|
headerForm.value.$el.appendChild(headerFormSecond.value.$el.firstChild)
|
||||||
// 把第一行放不下的复制一份放到headerFormSecond.value.$el
|
}
|
||||||
let width = 0
|
// 获取第一行放了几个表单
|
||||||
for (let i = 0; i < elFormItem.length; i++) {
|
const elFormItem = headerForm.value.$el.querySelectorAll('.el-form-item')
|
||||||
width += elFormItem[i].offsetWidth + 32
|
|
||||||
|
// 把第一行放不下的复制一份放到headerFormSecond.value.$el
|
||||||
if (width > headerForm.value.$el.offsetWidth) {
|
let width = 0
|
||||||
headerFormSecond.value.$el.appendChild(elFormItem[i])
|
for (let i = 0; i < elFormItem.length; i++) {
|
||||||
}
|
width += elFormItem[i].offsetWidth + 32
|
||||||
}
|
|
||||||
|
if (width > headerForm.value.$el.offsetWidth) {
|
||||||
// 判断是否需要折叠
|
headerFormSecond.value.$el.appendChild(elFormItem[i])
|
||||||
if (headerFormSecond.value.$el.scrollHeight > 0) {
|
}
|
||||||
showUnfoldButton.value = true
|
}
|
||||||
} else {
|
|
||||||
showUnfoldButton.value = false
|
// 判断是否需要折叠
|
||||||
}
|
if (headerFormSecond.value.$el.scrollHeight > 0) {
|
||||||
}
|
showUnfoldButton.value = true
|
||||||
|
} else {
|
||||||
const showSelect = ref(false)
|
showUnfoldButton.value = false
|
||||||
const showSelectChange = () => {
|
}
|
||||||
showSelect.value = !showSelect.value
|
}
|
||||||
emit('selectChange', showSelect.value)
|
|
||||||
}
|
const showSelect = ref(false)
|
||||||
const onComSearch = async () => {
|
const showSelectChange = () => {
|
||||||
if (props.datePicker && timeAll.value) {
|
showSelect.value = !showSelect.value
|
||||||
tableStore.table.params.searchBeginTime = datePickerRef.value.timeValue[0]
|
emit('selectChange', showSelect.value)
|
||||||
tableStore.table.params.searchEndTime = datePickerRef.value.timeValue[1]
|
}
|
||||||
tableStore.table.params.startTime = datePickerRef.value.timeValue[0]
|
const onComSearch = async () => {
|
||||||
tableStore.table.params.endTime = datePickerRef.value.timeValue[1]
|
if (props.datePicker && timeAll.value) {
|
||||||
tableStore.table.params.timeFlag = datePickerRef.value.timeFlag
|
tableStore.table.params.searchBeginTime = datePickerRef.value.timeValue[0]
|
||||||
tableStore.table.params.interval = datePickerRef.value.interval
|
tableStore.table.params.searchEndTime = datePickerRef.value.timeValue[1]
|
||||||
}
|
tableStore.table.params.startTime = datePickerRef.value.timeValue[0]
|
||||||
|
tableStore.table.params.endTime = datePickerRef.value.timeValue[1]
|
||||||
await tableStore.onTableAction('search', {})
|
tableStore.table.params.timeFlag = datePickerRef.value.timeFlag
|
||||||
}
|
tableStore.table.params.interval = datePickerRef.value.interval
|
||||||
const setDatePicker = (list: any) => {
|
}
|
||||||
datePickerRef.value.setTimeOptions(list)
|
|
||||||
}
|
await tableStore.onTableAction('search', {})
|
||||||
const onResetForm = () => {
|
}
|
||||||
//时间重置成默认值
|
const setDatePicker = (list: any) => {
|
||||||
datePickerRef.value?.setTheDate(3)
|
datePickerRef.value.setTimeOptions(list)
|
||||||
tableStore.onTableAction('reset', {})
|
}
|
||||||
}
|
const onResetForm = () => {
|
||||||
const setTheDate = (val: any) => {
|
//时间重置成默认值
|
||||||
datePickerRef.value.setTheDate(val)
|
datePickerRef.value?.setTheDate(3)
|
||||||
}
|
|
||||||
// 导出
|
if(props.showTimeAll){
|
||||||
const onExport = () => {
|
timeAll.value = false
|
||||||
console.log('导出')
|
delete tableStore.table.params.searchBeginTime
|
||||||
tableStore.onTableAction('export', { showAllFlag: true })
|
delete tableStore.table.params.searchEndTime
|
||||||
}
|
delete tableStore.table.params.startTime
|
||||||
|
delete tableStore.table.params.endTime
|
||||||
defineExpose({
|
delete tableStore.table.params.timeFlag
|
||||||
onComSearch,
|
delete tableStore.table.params.interval
|
||||||
areaRef,
|
}
|
||||||
setDatePicker,
|
|
||||||
setTheDate,
|
if (props.datePicker && timeAll.value) {
|
||||||
datePickerRef,
|
tableStore.table.params.searchBeginTime = datePickerRef.value.timeValue[0]
|
||||||
showSelectChange,
|
tableStore.table.params.searchEndTime = datePickerRef.value.timeValue[1]
|
||||||
showSelect,
|
tableStore.table.params.startTime = datePickerRef.value.timeValue[0]
|
||||||
computedSearchRow,
|
tableStore.table.params.endTime = datePickerRef.value.timeValue[1]
|
||||||
onExport
|
tableStore.table.params.timeFlag = datePickerRef.value.timeFlag
|
||||||
})
|
tableStore.table.params.interval = datePickerRef.value.interval
|
||||||
</script>
|
}
|
||||||
|
|
||||||
<style scoped lang="scss">
|
tableStore.onTableAction('reset', {})
|
||||||
.cn-table-header {
|
}
|
||||||
border: 1px solid var(--el-border-color);
|
const setTheDate = (val: any) => {
|
||||||
}
|
datePickerRef.value.setTheDate(val)
|
||||||
|
}
|
||||||
.table-header {
|
// 导出
|
||||||
position: relative;
|
const onExport = () => {
|
||||||
overflow-x: auto;
|
console.log('222')
|
||||||
box-sizing: border-box;
|
tableStore.onTableAction('export', { showAllFlag: true })
|
||||||
display: flex;
|
}
|
||||||
align-items: center;
|
|
||||||
width: 100%;
|
defineExpose({
|
||||||
max-width: 100%;
|
onComSearch,
|
||||||
background-color: var(--ba-bg-color-overlay);
|
areaRef,
|
||||||
|
setDatePicker,
|
||||||
border-bottom: none;
|
setTheDate,
|
||||||
padding: 13px 15px;
|
datePickerRef,
|
||||||
font-size: 14px;
|
showSelectChange,
|
||||||
overflow: hidden;
|
showSelect,
|
||||||
.table-header-operate-text {
|
computedSearchRow,
|
||||||
margin-left: 6px;
|
onExport
|
||||||
}
|
})
|
||||||
}
|
</script>
|
||||||
|
|
||||||
.table-com-search {
|
<style scoped lang="scss">
|
||||||
box-sizing: border-box;
|
.cn-table-header {
|
||||||
width: 100%;
|
border: 1px solid var(--el-border-color);
|
||||||
max-width: 100%;
|
}
|
||||||
background-color: var(--ba-bg-color-overlay);
|
|
||||||
border: 1px solid var(--ba-border-color);
|
.table-header {
|
||||||
border-bottom: none;
|
position: relative;
|
||||||
padding: 13px 15px 20px 15px;
|
overflow-x: auto;
|
||||||
font-size: 14px;
|
box-sizing: border-box;
|
||||||
}
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
#header-form-second,
|
width: 100%;
|
||||||
#header-form {
|
max-width: 100%;
|
||||||
// display: flex;
|
background-color: var(--ba-bg-color-overlay);
|
||||||
// flex-wrap: wrap;
|
|
||||||
transition: all 0.3s;
|
border-bottom: none;
|
||||||
}
|
padding: 13px 15px;
|
||||||
|
font-size: 14px;
|
||||||
.mlr-12 {
|
overflow: hidden;
|
||||||
margin-left: 12px;
|
.table-header-operate-text {
|
||||||
}
|
margin-left: 6px;
|
||||||
|
}
|
||||||
.mlr-12 + .el-button {
|
}
|
||||||
margin-left: 12px;
|
|
||||||
}
|
.table-com-search {
|
||||||
|
box-sizing: border-box;
|
||||||
.table-search {
|
width: 100%;
|
||||||
display: flex;
|
max-width: 100%;
|
||||||
margin-left: auto;
|
background-color: var(--ba-bg-color-overlay);
|
||||||
|
border: 1px solid var(--ba-border-color);
|
||||||
.quick-search {
|
border-bottom: none;
|
||||||
width: auto;
|
padding: 13px 15px 20px 15px;
|
||||||
}
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-search-button-group {
|
#header-form-second,
|
||||||
display: flex;
|
#header-form {
|
||||||
margin-left: 12px;
|
// display: flex;
|
||||||
border: 1px solid var(--el-border-color);
|
// flex-wrap: wrap;
|
||||||
border-radius: var(--el-border-radius-base);
|
transition: all 0.3s;
|
||||||
overflow: hidden;
|
}
|
||||||
|
|
||||||
button:focus,
|
.mlr-12 {
|
||||||
button:active {
|
margin-left: 12px;
|
||||||
background-color: var(--ba-bg-color-overlay);
|
}
|
||||||
}
|
|
||||||
|
.mlr-12 + .el-button {
|
||||||
button:hover {
|
margin-left: 12px;
|
||||||
background-color: var(--el-color-info-light-7);
|
}
|
||||||
}
|
|
||||||
|
.table-search {
|
||||||
.table-search-button-item {
|
display: flex;
|
||||||
height: 30px;
|
margin-left: auto;
|
||||||
border: none;
|
|
||||||
border-radius: 0;
|
.quick-search {
|
||||||
}
|
width: auto;
|
||||||
|
}
|
||||||
.el-button + .el-button {
|
}
|
||||||
margin: 0;
|
|
||||||
}
|
.table-search-button-group {
|
||||||
|
display: flex;
|
||||||
.right-border {
|
margin-left: 12px;
|
||||||
border-right: 1px solid var(--el-border-color);
|
border: 1px solid var(--el-border-color);
|
||||||
}
|
border-radius: var(--el-border-radius-base);
|
||||||
}
|
overflow: hidden;
|
||||||
|
|
||||||
html.dark {
|
button:focus,
|
||||||
.table-search-button-group {
|
button:active {
|
||||||
button:focus,
|
background-color: var(--ba-bg-color-overlay);
|
||||||
button:active {
|
}
|
||||||
background-color: var(--el-color-info-dark-2);
|
|
||||||
}
|
button:hover {
|
||||||
|
background-color: var(--el-color-info-light-7);
|
||||||
button:hover {
|
}
|
||||||
background-color: var(--el-color-info-light-7);
|
|
||||||
}
|
.table-search-button-item {
|
||||||
|
height: 30px;
|
||||||
button {
|
border: none;
|
||||||
background-color: var(--ba-bg-color-overlay);
|
border-radius: 0;
|
||||||
|
}
|
||||||
el-icon {
|
|
||||||
color: white !important;
|
.el-button + .el-button {
|
||||||
}
|
margin: 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
.right-border {
|
||||||
|
border-right: 1px solid var(--el-border-color);
|
||||||
#header-form,
|
}
|
||||||
#header-form-second {
|
}
|
||||||
:deep(.el-select) {
|
|
||||||
--el-select-width: 220px;
|
html.dark {
|
||||||
}
|
.table-search-button-group {
|
||||||
|
button:focus,
|
||||||
:deep(.el-input) {
|
button:active {
|
||||||
--el-input-width: 220px;
|
background-color: var(--el-color-info-dark-2);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</style>
|
button:hover {
|
||||||
|
background-color: var(--el-color-info-light-7);
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
background-color: var(--ba-bg-color-overlay);
|
||||||
|
|
||||||
|
el-icon {
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#header-form,
|
||||||
|
#header-form-second {
|
||||||
|
:deep(.el-select) {
|
||||||
|
--el-select-width: 220px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-input) {
|
||||||
|
--el-input-width: 220px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -1,43 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :style="{ height:props.height?props.height: tableStore.table.height }">
|
<div :style="{ height: typeof props.height === 'string' ? props.height : tableStore.table.height }">
|
||||||
<vxe-table
|
<vxe-table ref="tableRef" height="auto" :key="key" :data="tableStore.table.data"
|
||||||
ref="tableRef"
|
v-loading="tableStore.table.loading" v-bind="Object.assign({}, defaultAttribute, $attrs)"
|
||||||
height="auto"
|
@checkbox-all="selectChangeEvent" @checkbox-change="selectChangeEvent" :showOverflow="showOverflow"
|
||||||
:key="key"
|
@sort-change="handleSortChange">
|
||||||
:data="tableStore.table.data"
|
|
||||||
v-loading="tableStore.table.loading"
|
|
||||||
v-bind="Object.assign({}, defaultAttribute, $attrs)"
|
|
||||||
@checkbox-all="selectChangeEvent"
|
|
||||||
@checkbox-change="selectChangeEvent"
|
|
||||||
:showOverflow="showOverflow"
|
|
||||||
@sort-change="handleSortChange"
|
|
||||||
>
|
|
||||||
<!-- Column 组件内部是 el-table-column -->
|
<!-- Column 组件内部是 el-table-column -->
|
||||||
<template v-if="isGroup">
|
<template v-if="isGroup">
|
||||||
<GroupColumn :column="tableStore.table.column" />
|
<GroupColumn :column="tableStore.table.column" />
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<Column
|
<Column :attr="item" :key="key + '-column'" v-for="(item, key) in tableStore.table.column"
|
||||||
:attr="item"
|
:tree-node="item.treeNode">
|
||||||
:key="key + '-column'"
|
|
||||||
v-for="(item, key) in tableStore.table.column"
|
|
||||||
:tree-node="item.treeNode"
|
|
||||||
>
|
|
||||||
<!-- tableStore 预设的列 render 方案 -->
|
<!-- tableStore 预设的列 render 方案 -->
|
||||||
<template v-if="item.render" #default="scope">
|
<template v-if="item.render" #default="scope">
|
||||||
<FieldRender
|
<FieldRender :field="item" :row="scope.row" :column="scope.column" :index="scope.rowIndex" :key="key +
|
||||||
:field="item"
|
'-' +
|
||||||
:row="scope.row"
|
item.render +
|
||||||
:column="scope.column"
|
'-' +
|
||||||
:index="scope.rowIndex"
|
(item.field ? '-' + item.field + '-' + scope.row[item.field] : '')
|
||||||
:key="
|
" />
|
||||||
key +
|
|
||||||
'-' +
|
|
||||||
item.render +
|
|
||||||
'-' +
|
|
||||||
(item.field ? '-' + item.field + '-' + scope.row[item.field] : '')
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
</Column>
|
</Column>
|
||||||
</template>
|
</template>
|
||||||
@@ -46,16 +27,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="tableStore.showPage" class="table-pagination">
|
<div v-if="tableStore.showPage" class="table-pagination">
|
||||||
<el-pagination
|
<el-pagination :currentPage="tableStore.table.params!.pageNum" :page-size="tableStore.table.params!.pageSize"
|
||||||
:currentPage="tableStore.table.params!.pageNum"
|
:page-sizes="pageSizes" background
|
||||||
:page-size="tableStore.table.params!.pageSize"
|
|
||||||
:page-sizes="pageSizes"
|
|
||||||
background
|
|
||||||
:layout="config.layout.shrink ? 'prev, next, jumper' : 'sizes,total, ->, prev, pager, next, jumper'"
|
:layout="config.layout.shrink ? 'prev, next, jumper' : 'sizes,total, ->, prev, pager, next, jumper'"
|
||||||
:total="tableStore.table.total"
|
:total="tableStore.table.total" @size-change="onTableSizeChange"
|
||||||
@size-change="onTableSizeChange"
|
@current-change="onTableCurrentChange"></el-pagination>
|
||||||
@current-change="onTableCurrentChange"
|
|
||||||
></el-pagination>
|
|
||||||
</div>
|
</div>
|
||||||
<slot name="footer"></slot>
|
<slot name="footer"></slot>
|
||||||
</template>
|
</template>
|
||||||
@@ -80,13 +56,13 @@ const key = ref(0)
|
|||||||
interface Props extends /* @vue-ignore */ Partial<InstanceType<typeof ElTable>> {
|
interface Props extends /* @vue-ignore */ Partial<InstanceType<typeof ElTable>> {
|
||||||
isGroup?: boolean
|
isGroup?: boolean
|
||||||
showOverflow?: boolean
|
showOverflow?: boolean
|
||||||
height?: string | boolean
|
height?: string | number
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
isGroup: false,
|
isGroup: false,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
height: false
|
height: undefined
|
||||||
})
|
})
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
tableStore.table.ref = tableRef.value as VxeTableInstance
|
tableStore.table.ref = tableRef.value as VxeTableInstance
|
||||||
|
|||||||
205
src/components/tree/details/monitoringPointDetails.vue
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog draggable v-model="dialogVisible" :title="title" width="1200px">
|
||||||
|
<el-tabs type="border-card" v-model="activeName" @tab-click="handleClick">
|
||||||
|
<el-tab-pane label="监测点详情" name="tab1">
|
||||||
|
<el-descriptions :column="3" border label-width="150px">
|
||||||
|
<el-descriptions-item label="项目工程">
|
||||||
|
{{ details.areaName }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="项目单位">
|
||||||
|
{{ details.gdName }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="所属变电站">
|
||||||
|
{{ details.bdName }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="电压等级">
|
||||||
|
{{ details.scale }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="终端厂家">
|
||||||
|
{{ details.manufacturer }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="终端名称">
|
||||||
|
{{ details.devName }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="网络参数">
|
||||||
|
{{ details.ip }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="监测点名称">
|
||||||
|
{{ details.lineName }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="监测点序号">
|
||||||
|
{{ details.id }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="通讯状态">
|
||||||
|
{{ details.comFlag }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="干扰源类型">
|
||||||
|
{{ details.loadType }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="监测点对象名称">
|
||||||
|
{{ details.objName }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="接线方式">
|
||||||
|
{{ details.ptType }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="PT变比">
|
||||||
|
{{ details.pt }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="CT变比">
|
||||||
|
{{ details.ct }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="基准容量(MVA)">
|
||||||
|
{{ details.standardCapacity }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="最小短路容量(MVA)">
|
||||||
|
{{ details.shortCapacity }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="供电设备容量(MVA)">
|
||||||
|
{{ details.devCapacity }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="用户协议容量(MVA)">
|
||||||
|
{{ details.dealCapacity }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="监测点限值" name="tab2">
|
||||||
|
<el-descriptions :column="3" border label-width="250px">
|
||||||
|
<el-descriptions-item label="电压偏差上限值(%)">
|
||||||
|
{{ limitValue.voltageDev }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="电压偏差下限值(%)">
|
||||||
|
{{ limitValue.uvoltageDev }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="频率偏差限值(Hz)">
|
||||||
|
{{ limitValue.freqDev }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="三相电压不平衡度限值(%)">
|
||||||
|
{{ limitValue.ubalance }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="负序电流限值(A)">
|
||||||
|
{{ limitValue.ineg }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="长时闪变限值(%)">
|
||||||
|
{{ limitValue.flicker }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="电压总畸变率限值(%)">
|
||||||
|
{{ limitValue.uaberrance }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="奇次谐波电压含有率限值(%)">
|
||||||
|
{{ limitValue.oddHarm }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="偶次谐波电压含有率限值(%)">
|
||||||
|
{{ limitValue.evenHarm }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="3次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm3 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="4次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm4 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="5次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm5 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="6次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm6 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="7次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm7 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="8次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm8 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="9次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm9 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="10次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm10 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="11次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm11 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="12次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm12 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="13次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm13 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="14次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm14 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="15次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm15 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="16次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm16 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="17次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm17 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="18次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm18 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="19次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm19 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="20次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm20 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="21次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm21 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="22次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm22 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="23次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm23 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="24次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm24 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="25次谐波电流幅值限值(A)">
|
||||||
|
{{ limitValue.iharm25 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="0.5-1.5次间谐波电压含有率限值(%)">
|
||||||
|
{{ limitValue.inUharm }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="2.5-15.5次谐波电压含有率限值(%)">
|
||||||
|
{{ limitValue.inUharm16 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, inject } from 'vue'
|
||||||
|
import { getLineOverLimitData, getLineDetailData } from '@/api/device-boot/line'
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const title = ref('')
|
||||||
|
const activeName = ref('tab1')
|
||||||
|
const details: any = ref([])
|
||||||
|
const limitValue: any = ref([])
|
||||||
|
const open = (data: any) => {
|
||||||
|
details.value = []
|
||||||
|
limitValue.value = []
|
||||||
|
activeName.value = 'tab1'
|
||||||
|
title.value = data.name.replace(/([^)]*)/g, '') + '_详情'
|
||||||
|
|
||||||
|
getLineDetailData(data.id).then(res => {
|
||||||
|
details.value = res.data
|
||||||
|
|
||||||
|
})
|
||||||
|
getLineOverLimitData(data.id).then(res => {
|
||||||
|
limitValue.value = res.data
|
||||||
|
})
|
||||||
|
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
const handleClick = (tab: any, event: Event) => {}
|
||||||
|
defineExpose({ open })
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
:deep(.el-upload-list__item) {
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
34
src/components/tree/details/substationDetails.vue
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog draggable v-model="dialogVisible" :title="title" width="500px">
|
||||||
|
<el-descriptions class="margin-top" :column="1" border label-width="150px">
|
||||||
|
<el-descriptions-item label="变电站名称">{{ list[0]?.srbName }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="电压等级">{{ list[0]?.scale }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="经度">{{ list[0]?.coordY }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="纬度">{{ list[0]?.coordX }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, inject } from 'vue'
|
||||||
|
import { getSubstationSelectLine } from '@/api/device-boot/line'
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const title = ref('')
|
||||||
|
const list: any = ref([])
|
||||||
|
const open = (data: any) => {
|
||||||
|
list.value = []
|
||||||
|
title.value = data.name.replace(/([^)]*)/g, '') + '_详情'
|
||||||
|
|
||||||
|
getSubstationSelectLine(data.id).then(res => {
|
||||||
|
list.value = res.data
|
||||||
|
})
|
||||||
|
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({ open })
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
:deep(.el-upload-list__item) {
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,162 +1,272 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :style="{ width: menuCollapse ? '40px' : props.width }" style="transition: all 0.3s; overflow: hidden">
|
<div :style="{ width: menuCollapse ? '40px' : props.width }" style="transition: all 0.3s; overflow: hidden">
|
||||||
<Icon v-show="menuCollapse" @click="onMenuCollapse" :name="menuCollapse ? 'el-icon-Expand' : 'el-icon-Fold'"
|
<Icon
|
||||||
:class="menuCollapse ? 'unfold' : ''" size="18" class="fold ml10 mt20 menu-collapse"
|
v-show="menuCollapse"
|
||||||
style="cursor: pointer" />
|
@click="onMenuCollapse"
|
||||||
<div class="cn-tree" :style="{ opacity: menuCollapse ? 0 : 1 }">
|
:name="menuCollapse ? 'el-icon-Expand' : 'el-icon-Fold'"
|
||||||
<div style="display: flex; align-items: center" class="mb10">
|
:class="menuCollapse ? 'unfold' : ''"
|
||||||
<el-input v-model="filterText" placeholder="请输入内容" clearable maxlength="10" show-word-limit @input="change">
|
size="18"
|
||||||
<template #prefix>
|
class="fold ml10 mt20 menu-collapse"
|
||||||
<Icon name="el-icon-Search" style="font-size: 16px" />
|
style="cursor: pointer"
|
||||||
</template>
|
/>
|
||||||
</el-input>
|
<div class="cn-tree" :style="{ opacity: menuCollapse ? 0 : 1 }">
|
||||||
<Icon @click="onMenuCollapse" :name="menuCollapse ? 'el-icon-Expand' : 'el-icon-Fold'"
|
<div style="display: flex; align-items: center" class="mb10">
|
||||||
:class="menuCollapse ? 'unfold' : ''" size="18" class="fold ml10 menu-collapse"
|
<el-input
|
||||||
style="cursor: pointer" v-if="props.canExpand" />
|
v-model="filterText"
|
||||||
<el-button icon="el-icon-Plus" v-if="props.addTree" type="primary" class="ml10"
|
placeholder="请输入内容"
|
||||||
@click="onAddTree">新增</el-button>
|
clearable
|
||||||
</div>
|
maxlength="10"
|
||||||
<el-tree style="flex: 1; overflow: auto" ref="treeRef" :props="defaultProps" highlight-current
|
show-word-limit
|
||||||
:filter-node-method="filterNode" node-key="id" v-bind="$attrs">
|
@input="change"
|
||||||
<template #default="{ node, data }">
|
>
|
||||||
<span class="custom-tree-node">
|
<template #prefix>
|
||||||
<Icon :name="data.icon" style="font-size: 16px" :style="{ color: data.color }"
|
<Icon name="el-icon-Search" style="font-size: 16px" />
|
||||||
v-if="data.icon" />
|
</template>
|
||||||
<span style="margin-left: 4px">{{ node.label }}</span>
|
</el-input>
|
||||||
</span>
|
<Icon
|
||||||
</template>
|
@click="onMenuCollapse"
|
||||||
</el-tree>
|
:name="menuCollapse ? 'el-icon-Expand' : 'el-icon-Fold'"
|
||||||
</div>
|
:class="menuCollapse ? 'unfold' : ''"
|
||||||
</div>
|
size="18"
|
||||||
</template>
|
class="fold ml10 menu-collapse"
|
||||||
|
style="cursor: pointer"
|
||||||
<script lang="ts" setup>
|
v-if="props.canExpand"
|
||||||
import useCurrentInstance from '@/utils/useCurrentInstance'
|
/>
|
||||||
import { ElTree } from 'element-plus'
|
<el-button icon="el-icon-Plus" v-if="props.addTree" type="primary" class="ml10" @click="onAddTree">
|
||||||
import { ref, watch } from 'vue'
|
新增
|
||||||
import { ElMessage } from 'element-plus'
|
</el-button>
|
||||||
defineOptions({
|
</div>
|
||||||
name: 'govern/tree'
|
<el-tree
|
||||||
})
|
style="flex: 1; overflow: auto"
|
||||||
const emit = defineEmits(['onAddTree'])
|
ref="treeRef"
|
||||||
interface Props {
|
:props="defaultProps"
|
||||||
width?: string
|
highlight-current
|
||||||
canExpand?: boolean
|
:filter-node-method="filterNode"
|
||||||
addTree?: boolean
|
node-key="id"
|
||||||
}
|
v-bind="$attrs"
|
||||||
|
>
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
<template #default="{ node, data }">
|
||||||
width: '280px',
|
<span class="custom-tree-node">
|
||||||
canExpand: true,
|
<Icon
|
||||||
addTree: false
|
:name="data.icon"
|
||||||
})
|
style="font-size: 16px"
|
||||||
const { proxy } = useCurrentInstance()
|
:style="{ color: data.color }"
|
||||||
const menuCollapse = ref(false)
|
v-if="data.icon"
|
||||||
const filterText = ref('')
|
/>
|
||||||
const defaultProps = {
|
|
||||||
label: 'name',
|
<el-tooltip
|
||||||
value: 'id'
|
class="box-item"
|
||||||
}
|
effect="customized"
|
||||||
const specialCharsPattern = /[`~!@$%^&*\-+=<>?:"{}|,.\/;'\\[\]·~!@¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、~]/g;
|
placement="bottom-start"
|
||||||
const change=(val) => {
|
:offset="0"
|
||||||
|
v-if="data.level == 6"
|
||||||
|
>
|
||||||
if (specialCharsPattern.test(val)) {
|
<template #content>
|
||||||
ElMessage.warning('禁止输入特殊字符!')
|
<el-button type="primary" plain @click="viewDetails(data)">
|
||||||
filterText.value = val.replace(/[`~!@$%^&*\-+=<>?:"{}|,.\/;'\\[\]·~!@¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、~]/g, "")
|
{{ data.level == 3 ? '变电站详情' : '监测点详情' }}
|
||||||
console.log("🚀 ~ change ~ filterText.value:", filterText.value)
|
</el-button>
|
||||||
|
</template>
|
||||||
treeRef.value!.filter(filterText.value)
|
<span style="margin-left: 4px">{{ node.label }}</span>
|
||||||
}else{
|
</el-tooltip>
|
||||||
treeRef.value!.filter(filterText.value)
|
<span v-else style="margin-left: 4px">{{ node.label }}</span>
|
||||||
}
|
</span>
|
||||||
}
|
</template>
|
||||||
// watch(filterText, val => {
|
</el-tree>
|
||||||
|
</div>
|
||||||
// console.log("🚀 ~ val:", specialCharsPattern.test(val))
|
<!-- 变电站详情 -->
|
||||||
// if (specialCharsPattern.test(val)) {
|
<SubstationDetails ref="SubstationRef" />
|
||||||
// ElMessage.warning('禁止输入特殊字符!')
|
<!-- 监测点详情 -->
|
||||||
// filterText.value = val.replace(/[`~!@$%^&*\-+=<>?:"{}|,.\/;'\\[\]·~!@¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、~]/g, "")
|
<MonitoringPointDetails ref="MonitoringPointRef" />
|
||||||
// console.log("🚀 ~ filterText.value:", filterText.value)
|
</div>
|
||||||
// treeRef.value!.filter(filterText.value)
|
</template>
|
||||||
// }else{
|
|
||||||
// treeRef.value!.filter(filterText.value)
|
<script lang="ts" setup>
|
||||||
// }
|
import useCurrentInstance from '@/utils/useCurrentInstance'
|
||||||
|
import { ElTree } from 'element-plus'
|
||||||
// })
|
import { ref, watch, onMounted, nextTick } from 'vue'
|
||||||
const onMenuCollapse = () => {
|
import { ElMessage } from 'element-plus'
|
||||||
menuCollapse.value = !menuCollapse.value
|
import MonitoringPointDetails from './details/monitoringPointDetails.vue'
|
||||||
proxy.eventBus.emit('cnTreeCollapse', menuCollapse)
|
import SubstationDetails from './details/substationDetails.vue'
|
||||||
}
|
|
||||||
const filterNode = (value: string, data: any, node: any) => {
|
defineOptions({
|
||||||
if (!value) return true
|
name: 'govern/tree'
|
||||||
// return data.name.includes(value)
|
})
|
||||||
if (data.name) {
|
const emit = defineEmits(['onAddTree'])
|
||||||
|
interface Props {
|
||||||
return chooseNode(value, data, node)
|
width?: string
|
||||||
}
|
canExpand?: boolean
|
||||||
}
|
addTree?: boolean
|
||||||
|
}
|
||||||
// 过滤父节点 / 子节点 (如果输入的参数是父节点且能匹配,则返回该节点以及其下的所有子节点;如果参数是子节点,则返回该节点的父节点。name是中文字符,enName是英文字符.
|
|
||||||
const chooseNode = (value: string, data: any, node: any) => {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
width: '280px',
|
||||||
if (data.name.indexOf(value) !== -1) {
|
canExpand: true,
|
||||||
return true
|
addTree: false
|
||||||
}
|
})
|
||||||
const level = node.level
|
const { proxy } = useCurrentInstance()
|
||||||
// 如果传入的节点本身就是一级节点就不用校验了
|
const menuCollapse = ref(false)
|
||||||
if (level === 1) {
|
const MonitoringPointRef = ref()
|
||||||
return false
|
const SubstationRef = ref()
|
||||||
}
|
const filterText = ref('')
|
||||||
// 先取当前节点的父节点
|
const treeRef = ref()
|
||||||
let parentData = node.parent
|
const defaultProps = {
|
||||||
// 遍历当前节点的父节点
|
label: 'name',
|
||||||
let index = 0
|
value: 'id'
|
||||||
while (index < level - 1) {
|
}
|
||||||
// 如果匹配到直接返回,此处name值是中文字符,enName是英文字符。判断匹配中英文过滤
|
const specialCharsPattern = /[`~!@$%^&*\-+=<>?:"{}|,.\/;'\\[\]·~!@¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、~]/g
|
||||||
if (parentData.data.name.indexOf(value) !== -1) {
|
const change = val => {
|
||||||
return true
|
if (specialCharsPattern.test(val)) {
|
||||||
}
|
ElMessage.warning('禁止输入特殊字符!')
|
||||||
// 否则的话再往上一层做匹配
|
filterText.value = val.replace(
|
||||||
parentData = parentData.parent
|
/[`~!@$%^&*\-+=<>?:"{}|,.\/;'\\[\]·~!@¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、~]/g,
|
||||||
index++
|
''
|
||||||
}
|
)
|
||||||
// 没匹配到返回false
|
console.log('🚀 ~ change ~ filterText.value:', filterText.value)
|
||||||
return false
|
|
||||||
}
|
treeRef.value!.filter(filterText.value)
|
||||||
// 添加树
|
} else {
|
||||||
const onAddTree = () => {
|
treeRef.value!.filter(filterText.value)
|
||||||
emit('onAddTree')
|
}
|
||||||
}
|
}
|
||||||
const treeRef = ref<InstanceType<typeof ElTree>>()
|
// watch(filterText, val => {
|
||||||
defineExpose({ treeRef })
|
|
||||||
</script>
|
// console.log("🚀 ~ val:", specialCharsPattern.test(val))
|
||||||
|
// if (specialCharsPattern.test(val)) {
|
||||||
<style lang="scss" scoped>
|
// ElMessage.warning('禁止输入特殊字符!')
|
||||||
.cn-tree {
|
// filterText.value = val.replace(/[`~!@$%^&*\-+=<>?:"{}|,.\/;'\\[\]·~!@¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、~]/g, "")
|
||||||
flex-shrink: 0;
|
// console.log("🚀 ~ filterText.value:", filterText.value)
|
||||||
display: flex;
|
// treeRef.value!.filter(filterText.value)
|
||||||
flex-direction: column;
|
// }else{
|
||||||
box-sizing: border-box;
|
// treeRef.value!.filter(filterText.value)
|
||||||
padding: 10px;
|
// }
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
// })
|
||||||
|
const onMenuCollapse = () => {
|
||||||
:deep(.el-tree) {
|
menuCollapse.value = !menuCollapse.value
|
||||||
border: 1px solid var(--el-border-color);
|
proxy.eventBus.emit('cnTreeCollapse', menuCollapse)
|
||||||
}
|
}
|
||||||
|
// 查看详情
|
||||||
:deep(.el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content) {
|
const viewDetails = (data: any) => {
|
||||||
background-color: var(--el-color-primary-light-7);
|
console.log('🚀 ~ viewDetails ~ data:', data)
|
||||||
}
|
if (data.level == 3) {
|
||||||
|
// 变电站详情
|
||||||
.menu-collapse {
|
// substationDetails
|
||||||
color: var(--el-color-primary);
|
SubstationRef.value.open(data)
|
||||||
}
|
} else {
|
||||||
}
|
// 监测点详情
|
||||||
|
MonitoringPointRef.value.open(data)
|
||||||
.custom-tree-node {
|
}
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
// proxy.eventBus.emit('viewDetails', data)
|
||||||
}
|
}
|
||||||
</style>
|
const filterNode = (value: string, data: any, node: any) => {
|
||||||
|
if (!value) return true
|
||||||
|
// return data.name.includes(value)
|
||||||
|
if (data.name) {
|
||||||
|
return chooseNode(value, data, node)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 过滤父节点 / 子节点 (如果输入的参数是父节点且能匹配,则返回该节点以及其下的所有子节点;如果参数是子节点,则返回该节点的父节点。name是中文字符,enName是英文字符.
|
||||||
|
const chooseNode = (value: string, data: any, node: any) => {
|
||||||
|
if (data.name.indexOf(value) !== -1) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
const level = node.level
|
||||||
|
// 如果传入的节点本身就是一级节点就不用校验了
|
||||||
|
if (level === 1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// 先取当前节点的父节点
|
||||||
|
let parentData = node.parent
|
||||||
|
// 遍历当前节点的父节点
|
||||||
|
let index = 0
|
||||||
|
while (index < level - 1) {
|
||||||
|
// 如果匹配到直接返回,此处name值是中文字符,enName是英文字符。判断匹配中英文过滤
|
||||||
|
if (parentData.data.name.indexOf(value) !== -1) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// 否则的话再往上一层做匹配
|
||||||
|
parentData = parentData.parent
|
||||||
|
index++
|
||||||
|
}
|
||||||
|
// 没匹配到返回false
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
// 等待树渲染完成
|
||||||
|
await nextTick()
|
||||||
|
// 可以等待更长时间确保树完全展开
|
||||||
|
})
|
||||||
|
|
||||||
|
const scrollToNode = (id: string) => {
|
||||||
|
console.log("🚀 ~ scrollToNode ~ id:", id)
|
||||||
|
if (!treeRef.value) return
|
||||||
|
|
||||||
|
// 获取目标节点的元素
|
||||||
|
const targetNode = treeRef.value.getNode(id)
|
||||||
|
if (!targetNode) return
|
||||||
|
|
||||||
|
// 获取节点的DOM元素
|
||||||
|
const nodeElement = document.querySelector(`[data-key="${id}"]`)
|
||||||
|
if (nodeElement) {
|
||||||
|
// 滚动到节点位置
|
||||||
|
nodeElement.scrollIntoView({
|
||||||
|
behavior: 'smooth', // 平滑滚动
|
||||||
|
block: 'center', // 垂直方向居中
|
||||||
|
inline: 'nearest' // 水平方向最近
|
||||||
|
})
|
||||||
|
|
||||||
|
// 如果需要高亮当前节点
|
||||||
|
treeRef.value.setCurrentKey(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 添加树
|
||||||
|
const onAddTree = () => {
|
||||||
|
emit('onAddTree')
|
||||||
|
}
|
||||||
|
defineExpose({ treeRef, scrollToNode })
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.cn-tree {
|
||||||
|
flex-shrink: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 10px;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
:deep(.el-tree) {
|
||||||
|
border: 1px solid var(--el-border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content) {
|
||||||
|
background-color: var(--el-color-primary-light-7);
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-collapse {
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-tree-node {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style>
|
||||||
|
.el-popper.is-customized {
|
||||||
|
/* Set padding to ensure the height is 32px */
|
||||||
|
padding: 0;
|
||||||
|
background: var(--el-color-primary-light-3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-popper.is-customized .el-popper__arrow::before {
|
||||||
|
background: var(--el-color-primary-light-3);
|
||||||
|
right: 0;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -1,197 +1,197 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<Tree ref="treRef" :data="tree" style="height: 100%" :width="'100%'" :expanded="expanded" />
|
<Tree ref="treRef" :data="tree" style="height: 100%" :width="'100%'" :expanded="expanded" />
|
||||||
</template>
|
</template>
|
||||||
<!-- <div class="mb10">
|
<!-- <div class="mb10">
|
||||||
<el-button type="primary" icon="el-icon-Download" size="small" @click="exportExcelTemplate" :loading="loading">模版下载</el-button>
|
<el-button type="primary" icon="el-icon-Download" size="small" @click="exportExcelTemplate" :loading="loading">模版下载</el-button>
|
||||||
<el-button type="primary" icon="el-icon-Upload" size="small">导入</el-button>
|
<el-button type="primary" icon="el-icon-Upload" size="small">导入</el-button>
|
||||||
<el-button type="primary" icon="el-icon-Download" size="small" @click="ledgerEverywhere" :loading="loading1">导出</el-button>
|
<el-button type="primary" icon="el-icon-Download" size="small" @click="ledgerEverywhere" :loading="loading1">导出</el-button>
|
||||||
</div> -->
|
</div> -->
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, nextTick } from 'vue'
|
import { ref, nextTick } from 'vue'
|
||||||
import Tree from './index.vue'
|
import Tree from './index.vue'
|
||||||
|
|
||||||
import { getTerminalTree,downTerminalTemplate,exportTerminalBase } from '@/api/device-boot/Business'
|
import { getTerminalTree,downTerminalTemplate,exportTerminalBase } from '@/api/device-boot/Business'
|
||||||
import { useConfig } from '@/stores/config'
|
import { useConfig } from '@/stores/config'
|
||||||
const VITE_FLAG = import.meta.env.VITE_NAME == 'jibei'
|
const VITE_FLAG = import.meta.env.VITE_NAME == 'jibei'
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'govern/deviceTree'
|
name: 'govern/deviceTree'
|
||||||
})
|
})
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const loading1 = ref(false)
|
const loading1 = ref(false)
|
||||||
const emit = defineEmits(['init'])
|
const emit = defineEmits(['init'])
|
||||||
const config = useConfig()
|
const config = useConfig()
|
||||||
const expanded: any = ref([])
|
const expanded: any = ref([])
|
||||||
const tree = ref()
|
const tree = ref()
|
||||||
const treRef = ref()
|
const treRef = ref()
|
||||||
const info = (id: any) => {
|
const info = (id: any) => {
|
||||||
expanded.value = [id]
|
expanded.value = [id]
|
||||||
getTerminalTree().then(res => {
|
getTerminalTree().then(res => {
|
||||||
// let arr: any[] = []
|
// let arr: any[] = []
|
||||||
if (VITE_FLAG) {
|
if (VITE_FLAG) {
|
||||||
res.data.forEach((item: any) => {
|
res.data.forEach((item: any) => {
|
||||||
item.icon = 'el-icon-Menu'
|
item.icon = 'el-icon-Menu'
|
||||||
item.plevel = item.level
|
item.plevel = item.level
|
||||||
item.level = 0
|
item.level = 0
|
||||||
item.children.forEach((item2: any) => {
|
item.children.forEach((item2: any) => {
|
||||||
item2.icon = 'el-icon-HomeFilled'
|
item2.icon = 'el-icon-HomeFilled'
|
||||||
|
|
||||||
item2.plevel = item2.level
|
item2.plevel = item2.level
|
||||||
item2.level = 100
|
item2.level = 100
|
||||||
expanded.value.push(item2.id)
|
expanded.value.push(item2.id)
|
||||||
item2.children.forEach((item3: any) => {
|
item2.children.forEach((item3: any) => {
|
||||||
item3.icon = 'el-icon-CollectionTag'
|
item3.icon = 'el-icon-CollectionTag'
|
||||||
item3.plevel = item3.level
|
item3.plevel = item3.level
|
||||||
item3.level = 200
|
item3.level = 200
|
||||||
item3.children.forEach((item4: any) => {
|
item3.children.forEach((item4: any) => {
|
||||||
item4.icon = 'el-icon-Flag'
|
item4.icon = 'el-icon-Flag'
|
||||||
item4.plevel = item4.level
|
item4.plevel = item4.level
|
||||||
item4.level = 300
|
item4.level = 300
|
||||||
// arr.push(item4)
|
// arr.push(item4)
|
||||||
item4.children.forEach((item5: any) => {
|
item4.children.forEach((item5: any) => {
|
||||||
item5.icon = 'el-icon-OfficeBuilding'
|
item5.icon = 'el-icon-OfficeBuilding'
|
||||||
item5.plevel = item5.level
|
item5.plevel = item5.level
|
||||||
item5.level = 300
|
item5.level = 300
|
||||||
// item5.id = item4.id
|
// item5.id = item4.id
|
||||||
item5.children.forEach((item6: any) => {
|
item5.children.forEach((item6: any) => {
|
||||||
item6.icon = 'el-icon-HelpFilled'
|
item6.icon = 'el-icon-HelpFilled'
|
||||||
item6.plevel = 4
|
item6.plevel = 4
|
||||||
if (item6.name == '电网侧' && item6.children.length == 0) {
|
if (item6.name == '电网侧' && item6.children.length == 0) {
|
||||||
item6.level = 400
|
item6.level = 400
|
||||||
} else {
|
} else {
|
||||||
item6.level = 400
|
item6.level = 400
|
||||||
}
|
}
|
||||||
item6.children.forEach((item7: any) => {
|
item6.children.forEach((item7: any) => {
|
||||||
item7.icon = 'el-icon-Film'
|
item7.icon = 'el-icon-Film'
|
||||||
item7.plevel = item7.level
|
item7.plevel = item7.level
|
||||||
item7.level = 400
|
item7.level = 400
|
||||||
item7.children.forEach((item8: any) => {
|
item7.children.forEach((item8: any) => {
|
||||||
item8.icon = 'el-icon-Collection'
|
item8.icon = 'el-icon-Collection'
|
||||||
item8.plevel = item8.level
|
item8.plevel = item8.level
|
||||||
item8.level = 500
|
item8.level = 500
|
||||||
item8.children.forEach((item9: any) => {
|
item8.children.forEach((item9: any) => {
|
||||||
item9.icon = 'el-icon-Share'
|
item9.icon = 'el-icon-Share'
|
||||||
item9.plevel = item9.level
|
item9.plevel = item9.level
|
||||||
item9.level = 600
|
item9.level = 600
|
||||||
item9.children.forEach((item10: any) => {
|
item9.children.forEach((item10: any) => {
|
||||||
item10.icon = 'el-icon-Location'
|
item10.icon = 'el-icon-Location'
|
||||||
item10.plevel = item10.level
|
item10.plevel = item10.level
|
||||||
item10.level = 700
|
item10.level = 700
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
res.data.forEach((item: any) => {
|
res.data.forEach((item: any) => {
|
||||||
item.icon = 'el-icon-Menu'
|
item.icon = 'el-icon-Menu'
|
||||||
item.plevel = item.level
|
item.plevel = item.level
|
||||||
item.level = (item.level + 1) * 100
|
item.level = (item.level + 1) * 100
|
||||||
item.children.forEach((item2: any) => {
|
item.children.forEach((item2: any) => {
|
||||||
item2.icon = 'el-icon-HomeFilled'
|
item2.icon = 'el-icon-HomeFilled'
|
||||||
item2.plevel = item2.level
|
item2.plevel = item2.level
|
||||||
item2.level = (item2.level + 1) * 100
|
item2.level = (item2.level + 1) * 100
|
||||||
expanded.value.push(item2.id)
|
expanded.value.push(item2.id)
|
||||||
item2.children.forEach((item3: any) => {
|
item2.children.forEach((item3: any) => {
|
||||||
item3.icon = 'el-icon-CollectionTag'
|
item3.icon = 'el-icon-CollectionTag'
|
||||||
item3.plevel = item3.level
|
item3.plevel = item3.level
|
||||||
item3.level = (item3.level + 1) * 100
|
item3.level = (item3.level + 1) * 100
|
||||||
item3.children.forEach((item4: any) => {
|
item3.children.forEach((item4: any) => {
|
||||||
item4.icon = 'el-icon-Flag'
|
item4.icon = 'el-icon-Flag'
|
||||||
item4.plevel = item4.level
|
item4.plevel = item4.level
|
||||||
item4.level = (item4.level + 1) * 100
|
item4.level = (item4.level + 1) * 100
|
||||||
item4.children.forEach((item5: any) => {
|
item4.children.forEach((item5: any) => {
|
||||||
item5.icon = 'el-icon-OfficeBuilding'
|
item5.icon = 'el-icon-OfficeBuilding'
|
||||||
item5.plevel = item5.level
|
item5.plevel = item5.level
|
||||||
item5.level = (item5.level == 7 ? 4 : item5.level + 1) * 100
|
item5.level = (item5.level == 7 ? 4 : item5.level + 1) * 100
|
||||||
item5.children.forEach((item6: any) => {
|
item5.children.forEach((item6: any) => {
|
||||||
item6.icon = 'el-icon-Film'
|
item6.icon = 'el-icon-Film'
|
||||||
item6.plevel = item6.level
|
item6.plevel = item6.level
|
||||||
item6.level = (item6.level + 1) * 100
|
item6.level = (item6.level + 1) * 100
|
||||||
item6.children.forEach((item7: any) => {
|
item6.children.forEach((item7: any) => {
|
||||||
item7.icon = 'el-icon-Share'
|
item7.icon = 'el-icon-Share'
|
||||||
item7.plevel = item7.level
|
item7.plevel = item7.level
|
||||||
item7.level = (item7.level + 1) * 100
|
item7.level = (item7.level + 1) * 100
|
||||||
item7.children.forEach((item8: any) => {
|
item7.children.forEach((item8: any) => {
|
||||||
item8.icon = 'el-icon-Location'
|
item8.icon = 'el-icon-Location'
|
||||||
item8.plevel = item8.level
|
item8.plevel = item8.level
|
||||||
item8.level = (item8.level + 1) * 100
|
item8.level = (item8.level + 1) * 100
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
tree.value = res.data
|
tree.value = res.data
|
||||||
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
treRef.value.setCurrentKey(id)
|
treRef.value.setCurrentKey(id)
|
||||||
// if (arr.length) {
|
// if (arr.length) {
|
||||||
// treRef.value.treeRef.setCurrentKey(arr[0].id)
|
// treRef.value.treeRef.setCurrentKey(arr[0].id)
|
||||||
// // 注册父组件事件
|
// // 注册父组件事件
|
||||||
// emit('init', {
|
// emit('init', {
|
||||||
// level: 2,
|
// level: 2,
|
||||||
// ...arr[0]
|
// ...arr[0]
|
||||||
// })
|
// })
|
||||||
// } else {
|
// } else {
|
||||||
// emit('init')
|
// emit('init')
|
||||||
// }
|
// }
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 下载模版
|
// 下载模版
|
||||||
const exportExcelTemplate = async() => {
|
const exportExcelTemplate = async() => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
downTerminalTemplate().then((res: any) => {
|
downTerminalTemplate().then((res: any) => {
|
||||||
let blob = new Blob([res], {
|
let blob = new Blob([res], {
|
||||||
type: 'application/vnd.ms-excel'
|
type: 'application/vnd.ms-excel'
|
||||||
})
|
})
|
||||||
const url = window.URL.createObjectURL(blob)
|
const url = window.URL.createObjectURL(blob)
|
||||||
const link = document.createElement('a')
|
const link = document.createElement('a')
|
||||||
link.href = url
|
link.href = url
|
||||||
link.download = '终端台账模版'
|
link.download = '终端台账模版'
|
||||||
document.body.appendChild(link)
|
document.body.appendChild(link)
|
||||||
link.click()
|
link.click()
|
||||||
link.remove()
|
link.remove()
|
||||||
})
|
})
|
||||||
await setTimeout(() => {
|
await setTimeout(() => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
// 导出台账
|
// 导出台账
|
||||||
const ledgerEverywhere = async() => {
|
const ledgerEverywhere = async() => {
|
||||||
loading1.value = true
|
loading1.value = true
|
||||||
exportTerminalBase().then((res: any) => {
|
exportTerminalBase().then((res: any) => {
|
||||||
let blob = new Blob([res], {
|
let blob = new Blob([res], {
|
||||||
type: 'application/vnd.ms-excel'
|
type: 'application/vnd.ms-excel'
|
||||||
})
|
})
|
||||||
const url = window.URL.createObjectURL(blob)
|
const url = window.URL.createObjectURL(blob)
|
||||||
const link = document.createElement('a')
|
const link = document.createElement('a')
|
||||||
link.href = url
|
link.href = url
|
||||||
link.download = '终端台账'
|
link.download = '终端台账'
|
||||||
document.body.appendChild(link)
|
document.body.appendChild(link)
|
||||||
link.click()
|
link.click()
|
||||||
link.remove()
|
link.remove()
|
||||||
})
|
})
|
||||||
await setTimeout(() => {
|
await setTimeout(() => {
|
||||||
loading1.value = false
|
loading1.value = false
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
info('')
|
info('')
|
||||||
|
|
||||||
defineExpose({ info })
|
defineExpose({ info })
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.el-tree {
|
.el-tree {
|
||||||
background: #efeff0;
|
background: #efeff0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,88 +1,106 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="point-tree">
|
<div class="point-tree">
|
||||||
<div style="flex: 1; overflow: hidden">
|
<div style="flex: 1; overflow: hidden">
|
||||||
<Tree
|
<Tree
|
||||||
ref="treeRef"
|
ref="treeRef"
|
||||||
:data="tree"
|
:data="tree"
|
||||||
:canExpand="false"
|
:canExpand="false"
|
||||||
style="width: 100%; height: 100%"
|
style="width: 100%; height: 100%"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
default-expand-all
|
default-expand-all
|
||||||
|
@onAddTree="onAddTree"
|
||||||
@onAddTree="onAddTree"
|
/>
|
||||||
/>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
</template>
|
|
||||||
|
<script lang="ts" setup>
|
||||||
<script lang="ts" setup>
|
import { nextTick, onMounted, ref, useAttrs } from 'vue'
|
||||||
import { nextTick, onMounted, ref, useAttrs } from 'vue'
|
import Tree from '../index.vue'
|
||||||
import Tree from '../index.vue'
|
import { useAdminInfo } from '@/stores/adminInfo'
|
||||||
import { useAdminInfo } from '@/stores/adminInfo'
|
import { useDictData } from '@/stores/dictData'
|
||||||
import { useDictData } from '@/stores/dictData'
|
import { getTerminalTreeForFive } from '@/api/device-boot/terminalTree'
|
||||||
import { getTerminalTreeForFive } from '@/api/device-boot/terminalTree'
|
import { useConfig } from '@/stores/config'
|
||||||
import { useConfig } from '@/stores/config'
|
import { queryAllAlgorithmLibrary } from '@/api/supervision-boot/database/index'
|
||||||
import { queryAllAlgorithmLibrary } from '@/api/supervision-boot/database/index'
|
defineOptions({
|
||||||
defineOptions({
|
name: 'pms/pointTree'
|
||||||
name: 'pms/pointTree'
|
})
|
||||||
})
|
const emit = defineEmits(['init', 'onAddTree'])
|
||||||
const emit = defineEmits(['init', 'onAddTree'])
|
const attrs = useAttrs()
|
||||||
const attrs = useAttrs()
|
const adminInfo = useAdminInfo()
|
||||||
const adminInfo = useAdminInfo()
|
const dictData = useDictData()
|
||||||
const dictData = useDictData()
|
const config = useConfig()
|
||||||
const config = useConfig()
|
const classificationData = dictData.getBasicData('Statistical_Type', ['Report_Type'])
|
||||||
const classificationData = dictData.getBasicData('Statistical_Type', ['Report_Type'])
|
const tree = ref()
|
||||||
const tree = ref()
|
const treeRef = ref()
|
||||||
const treeRef = ref()
|
|
||||||
|
const loadData = (id?: any) => {
|
||||||
const loadData = (id?: any) => {
|
console.log('🚀 ~ loadData ~ id:', id)
|
||||||
console.log('🚀 ~ loadData ~ id:', id)
|
let nodeKey = ''
|
||||||
let nodeKey = ''
|
queryAllAlgorithmLibrary().then(res => {
|
||||||
queryAllAlgorithmLibrary().then(res => {
|
res.data.forEach((item: any) => {
|
||||||
res.data.forEach((item: any) => {
|
item.icon = 'el-icon-FolderOpened'
|
||||||
item.icon = 'el-icon-FolderOpened'
|
item.color = config.getColorVal('elementUiPrimary')
|
||||||
item.color = config.getColorVal('elementUiPrimary')
|
item.children.forEach((item2: any) => {
|
||||||
item.children.forEach((item2: any) => {
|
item2.icon = 'el-icon-Document'
|
||||||
item2.icon = 'el-icon-Document'
|
item2.color = config.getColorVal('elementUiPrimary')
|
||||||
item2.color = config.getColorVal('elementUiPrimary')
|
item2.childrens = item2.children
|
||||||
item2.childrens = item2.children
|
item2.children = []
|
||||||
item2.children = []
|
if (item2.id == id) {
|
||||||
if (item2.id == id) {
|
emit('init', item2)
|
||||||
emit('init', item2)
|
}
|
||||||
}
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
nodeKey = res.data[0].children[0].id
|
||||||
nodeKey = res.data[0].children[0].id
|
|
||||||
|
tree.value = res.data
|
||||||
tree.value = res.data
|
if (id) {
|
||||||
if (id) {
|
setTimeout(() => {
|
||||||
setTimeout(() => {
|
treeRef.value.treeRef.setCurrentKey(id)
|
||||||
treeRef.value.treeRef.setCurrentKey(id)
|
}, 10)
|
||||||
}, 10)
|
} else {
|
||||||
} else {
|
setTimeout(() => {
|
||||||
setTimeout(() => {
|
treeRef.value.treeRef.setCurrentKey(nodeKey)
|
||||||
treeRef.value.treeRef.setCurrentKey(nodeKey)
|
emit('init', res.data[0].children[0])
|
||||||
emit('init', res.data[0].children[0])
|
}, 10)
|
||||||
}, 10)
|
}
|
||||||
}
|
})
|
||||||
})
|
}
|
||||||
}
|
|
||||||
|
const onAddTree = () => {
|
||||||
const onAddTree = () => {
|
emit('onAddTree')
|
||||||
emit('onAddTree')
|
}
|
||||||
}
|
const setKey = (id: string) => {
|
||||||
loadData()
|
treeRef.value.treeRef.setCurrentKey(id)
|
||||||
defineExpose({ loadData })
|
return findNodeById(tree.value, id)
|
||||||
</script>
|
}
|
||||||
<style lang="scss">
|
const findNodeById = (tree1: any, targetId: any) => {
|
||||||
.point-tree {
|
for (const node of tree1) {
|
||||||
height: 100%;
|
// 1. 当前节点匹配ID,直接返回该节点
|
||||||
width: 100%;
|
if (node.id === targetId) {
|
||||||
display: flex;
|
return node
|
||||||
flex-direction: column;
|
}
|
||||||
background: #fff;
|
// 2. 当前节点有子节点,递归查找子节点
|
||||||
border: 1px solid var(--el-border-color);
|
if (node.children && node.children.length > 0) {
|
||||||
}
|
const result: any = findNodeById(node.children, targetId)
|
||||||
</style>
|
// 子节点中找到结果,立即返回(终止递归)
|
||||||
|
if (result) return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 3. 遍历完未找到,返回null
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
loadData()
|
||||||
|
defineExpose({ loadData, setKey })
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.point-tree {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid var(--el-border-color);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -14,9 +14,7 @@ import { useDictData } from '@/stores/dictData'
|
|||||||
import { getTerminalTreeForFive } from '@/api/device-boot/terminalTree'
|
import { getTerminalTreeForFive } from '@/api/device-boot/terminalTree'
|
||||||
import { useConfig } from '@/stores/config'
|
import { useConfig } from '@/stores/config'
|
||||||
import { defineProps } from 'vue'
|
import { defineProps } from 'vue'
|
||||||
import {
|
import { getTree } from '@/api/advance-boot/assess'
|
||||||
getTree
|
|
||||||
} from '@/api/advance-boot/assess'
|
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'pms/pointTree'
|
name: 'pms/pointTree'
|
||||||
@@ -46,25 +44,24 @@ const formData = ref({
|
|||||||
scale: null
|
scale: null
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// 添加数据转换函数
|
// 添加数据转换函数
|
||||||
const transformTreeData = (data: any[]) => {
|
const transformTreeData = (data: any[]) => {
|
||||||
if (!data || !Array.isArray(data)) return [];
|
if (!data || !Array.isArray(data)) return []
|
||||||
return data.map(item => {
|
return data.map(item => {
|
||||||
// 创建新对象,确保不修改原始数据
|
// 创建新对象,确保不修改原始数据
|
||||||
const newItem: any = {
|
const newItem: any = {
|
||||||
name: item.treeName ,
|
name: item.treeName,
|
||||||
id: item.treeId ,
|
id: item.treeId,
|
||||||
children: []
|
children: []
|
||||||
};
|
}
|
||||||
|
|
||||||
// 递归处理子节点
|
// 递归处理子节点
|
||||||
if (item.children && Array.isArray(item.children)) {
|
if (item.children && Array.isArray(item.children)) {
|
||||||
newItem.children = transformTreeData(item.children);
|
newItem.children = transformTreeData(item.children)
|
||||||
}
|
}
|
||||||
return newItem;
|
return newItem
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
|
|
||||||
const loadData = () => {
|
const loadData = () => {
|
||||||
let obj = classificationData.find(function (i) {
|
let obj = classificationData.find(function (i) {
|
||||||
@@ -73,19 +70,22 @@ const loadData = () => {
|
|||||||
let form = JSON.parse(JSON.stringify(formData.value))
|
let form = JSON.parse(JSON.stringify(formData.value))
|
||||||
form.statisticalType = classificationData.find((item: any) => item.id == form.statisticalType)
|
form.statisticalType = classificationData.find((item: any) => item.id == form.statisticalType)
|
||||||
let nodeKey = ''
|
let nodeKey = ''
|
||||||
getTree({}).then(res => {
|
getTree({}).then(res => {
|
||||||
// 转换数据结构为指定格式
|
// 转换数据结构为指定格式
|
||||||
const transformedData = transformTreeData(res.data);
|
const transformedData = transformTreeData(res.data)
|
||||||
|
|
||||||
// 确保有数据再进行处理
|
// 确保有数据再进行处理
|
||||||
if (transformedData && transformedData.length > 0 &&
|
if (
|
||||||
transformedData[0].children && transformedData[0].children.length > 0) {
|
transformedData &&
|
||||||
|
transformedData.length > 0 &&
|
||||||
|
transformedData[0].children &&
|
||||||
|
transformedData[0].children.length > 0
|
||||||
|
) {
|
||||||
nodeKey = transformedData[0].children[0].id
|
nodeKey = transformedData[0].children[0].id
|
||||||
emit('init', transformedData[0].children[0])
|
emit('init', transformedData[0].children[0])
|
||||||
|
|
||||||
tree.value = transformedData
|
tree.value = transformedData
|
||||||
|
|
||||||
if (nodeKey) {
|
if (nodeKey) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
treeRef.value.treeRef.setCurrentKey(nodeKey)
|
treeRef.value.treeRef.setCurrentKey(nodeKey)
|
||||||
@@ -94,7 +94,15 @@ const loadData = () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
const scrollToNode = (id: string) => {
|
||||||
|
// 树滚动
|
||||||
|
treeRef.value.scrollToNode(id)
|
||||||
|
}
|
||||||
loadData()
|
loadData()
|
||||||
|
defineExpose({
|
||||||
|
tree,
|
||||||
|
scrollToNode
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.point-tree {
|
.point-tree {
|
||||||
|
|||||||
@@ -1,154 +1,160 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="point-tree">
|
<div class="point-tree">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="formData.statisticalType"
|
v-model="formData.statisticalType"
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
style="min-width: unset; padding: 10px 10px 0"
|
style="min-width: unset; padding: 10px 10px 0"
|
||||||
@change="loadData"
|
@change="loadData"
|
||||||
v-if="props.showSelect"
|
v-if="props.showSelect"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in classificationData"
|
v-for="item in classificationData"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<div style="flex: 1; overflow: hidden">
|
<div style="flex: 1; overflow: hidden">
|
||||||
<Tree ref="treeRef" :data="tree" style="width: 100%; height: 100%" :canExpand="false" v-bind="$attrs" />
|
<Tree ref="treeRef" :data="tree" style="width: 100%; height: 100%" :canExpand="false" v-bind="$attrs" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { nextTick, onMounted, ref, useAttrs } from 'vue'
|
import { nextTick, onMounted, ref, useAttrs } from 'vue'
|
||||||
import Tree from '../index.vue'
|
import Tree from '../index.vue'
|
||||||
import { useAdminInfo } from '@/stores/adminInfo'
|
import { useAdminInfo } from '@/stores/adminInfo'
|
||||||
import { useDictData } from '@/stores/dictData'
|
import { useDictData } from '@/stores/dictData'
|
||||||
import { getTerminalTreeForFive } from '@/api/device-boot/terminalTree'
|
import { getTerminalTreeForFive } from '@/api/device-boot/terminalTree'
|
||||||
import { useConfig } from '@/stores/config'
|
import { useConfig } from '@/stores/config'
|
||||||
import { defineProps } from 'vue'
|
import { defineProps } from 'vue'
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'pms/pointTree'
|
name: 'pms/pointTree'
|
||||||
})
|
})
|
||||||
interface Props {
|
interface Props {
|
||||||
showSelect?: boolean
|
showSelect?: boolean
|
||||||
}
|
}
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
showSelect: true
|
showSelect: true
|
||||||
})
|
})
|
||||||
const emit = defineEmits(['init'])
|
const emit = defineEmits(['init'])
|
||||||
const attrs = useAttrs()
|
const attrs = useAttrs()
|
||||||
const adminInfo = useAdminInfo()
|
const adminInfo = useAdminInfo()
|
||||||
const dictData = useDictData()
|
const dictData = useDictData()
|
||||||
const config = useConfig()
|
const config = useConfig()
|
||||||
const classificationData = dictData.getBasicData('Statistical_Type', ['Report_Type'])
|
const classificationData = dictData.getBasicData('Statistical_Type', ['Report_Type'])
|
||||||
const tree = ref()
|
const tree = ref()
|
||||||
const treeRef = ref()
|
const treeRef = ref()
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
deptIndex: adminInfo.$state.deptIndex,
|
deptIndex: adminInfo.$state.deptIndex,
|
||||||
monitorFlag: 2,
|
monitorFlag: 2,
|
||||||
powerFlag: 2,
|
powerFlag: 2,
|
||||||
loadType: null,
|
loadType: null,
|
||||||
manufacturer: null,
|
manufacturer: null,
|
||||||
serverName: 'event-boot',
|
serverName: 'event-boot',
|
||||||
statisticalType: classificationData[0].id,
|
statisticalType: classificationData[0].id,
|
||||||
scale: null
|
scale: null
|
||||||
})
|
})
|
||||||
const loadData = () => {
|
const loadData = () => {
|
||||||
let obj = classificationData.find(function (i) {
|
let obj = classificationData.find(function (i) {
|
||||||
return i.id === formData.value.statisticalType
|
return i.id === formData.value.statisticalType
|
||||||
}) || { code: '' }
|
}) || { code: '' }
|
||||||
let form = JSON.parse(JSON.stringify(formData.value))
|
let form = JSON.parse(JSON.stringify(formData.value))
|
||||||
form.statisticalType = classificationData.find((item: any) => item.id == form.statisticalType)
|
form.statisticalType = classificationData.find((item: any) => item.id == form.statisticalType)
|
||||||
let nodeKey = ''
|
let nodeKey = ''
|
||||||
getTerminalTreeForFive(form).then(res => {
|
getTerminalTreeForFive(form).then(res => {
|
||||||
//console.log('---',res)
|
//console.log('---',res)
|
||||||
if (obj.code == 'Power_Network') {
|
if (obj.code == 'Power_Network') {
|
||||||
res.data = [
|
res.data = [
|
||||||
{
|
{
|
||||||
name: '电网拓扑',
|
name: '电网拓扑',
|
||||||
level: -1,
|
level: -1,
|
||||||
id: 0,
|
id: 0,
|
||||||
children: res.data
|
children: res.data
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
res.data.forEach((item: any) => {
|
res.data.forEach((item: any) => {
|
||||||
item.icon = 'el-icon-HomeFilled'
|
item.icon = 'el-icon-HomeFilled'
|
||||||
item.color = config.getColorVal('elementUiPrimary')
|
item.color = config.getColorVal('elementUiPrimary')
|
||||||
item.children.forEach((item2: any) => {
|
item.children.forEach((item2: any) => {
|
||||||
item2.icon = 'el-icon-CollectionTag'
|
item2.icon = 'el-icon-CollectionTag'
|
||||||
item2.color = config.getColorVal('elementUiPrimary')
|
item2.color = config.getColorVal('elementUiPrimary')
|
||||||
item2.children.forEach((item3: any) => {
|
item2.children.forEach((item3: any) => {
|
||||||
item3.icon = 'el-icon-Flag'
|
item3.icon = 'el-icon-Flag'
|
||||||
item3.color = config.getColorVal('elementUiPrimary')
|
item3.color = config.getColorVal('elementUiPrimary')
|
||||||
item3.children.forEach((item4: any) => {
|
item3.children.forEach((item4: any) => {
|
||||||
item4.icon = 'el-icon-OfficeBuilding'
|
item4.icon = 'el-icon-OfficeBuilding'
|
||||||
item4.color = config.getColorVal('elementUiPrimary')
|
item4.color = config.getColorVal('elementUiPrimary')
|
||||||
item4.children.forEach((item5: anyObj) => {
|
item4.children.forEach((item5: anyObj) => {
|
||||||
if (item5.level == 7) {
|
if (item5.level == 7) {
|
||||||
item5.icon = 'el-icon-DataAnalysis'
|
item5.icon = 'el-icon-DataAnalysis'
|
||||||
item5.color = config.getColorVal('elementUiPrimary')
|
item5.color = config.getColorVal('elementUiPrimary')
|
||||||
item5.children.forEach((item6: anyObj) => {
|
item5.children.forEach((item6: anyObj) => {
|
||||||
item6.alias = `${item.name}>${item2.name}>${item3.name}>${item4.name}>${item5.name}>${item6.name}`
|
item6.alias = `${item.name}>${item2.name}>${item3.name}>${item4.name}>${item5.name}>${item6.name}`
|
||||||
item6.pid = item4.id
|
item6.pid = item4.id
|
||||||
item6.icon = 'fa-solid fa-location-dot'
|
item6.icon = 'fa-solid fa-location-dot'
|
||||||
item6.color = config.getColorVal('elementUiPrimary')
|
item6.color = config.getColorVal('elementUiPrimary')
|
||||||
if (item6.comFlag == 0) {
|
if (item6.comFlag == 0) {
|
||||||
item6.color = 'red !important'
|
item6.color = 'red !important'
|
||||||
} else if (item6.comFlag == 1) {
|
} else if (item6.comFlag == 1) {
|
||||||
item6.color = '#00f93b !important'
|
item6.color = '#00f93b !important'
|
||||||
} else if (item6.comFlag == 2) {
|
} else if (item6.comFlag == 2) {
|
||||||
item6.color = '#8c8c8c !important'
|
item6.color = '#8c8c8c !important'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
item5.alias = `${item.name}>${item2.name}>${item3.name}>${item4.name}>${item5.name}`
|
item5.alias = `${item.name}>${item2.name}>${item3.name}>${item4.name}>${item5.name}`
|
||||||
item5.pid = item4.id
|
item5.pid = item4.id
|
||||||
item5.icon = 'fa-solid fa-location-dot'
|
item5.icon = 'fa-solid fa-location-dot'
|
||||||
item5.color = config.getColorVal('elementUiPrimary')
|
item5.color = config.getColorVal('elementUiPrimary')
|
||||||
if (item5.comFlag == 0) {
|
if (item5.comFlag == 0) {
|
||||||
item5.color = 'red !important'
|
item5.color = 'red !important'
|
||||||
} else if (item5.comFlag == 1) {
|
} else if (item5.comFlag == 1) {
|
||||||
item5.color = '#00f93b !important'
|
item5.color = '#00f93b !important'
|
||||||
} else if (item5.comFlag == 2) {
|
} else if (item5.comFlag == 2) {
|
||||||
item5.color = '#8c8c8c !important'
|
item5.color = '#8c8c8c !important'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
nodeKey =
|
nodeKey =
|
||||||
res.data[0].children[0].children[0].children[0].children[0].children[0]?.id ||
|
res.data[0].children[0].children[0].children[0].children[0].children[0]?.id ||
|
||||||
res.data[0].children[0].children[0].children[0].children[0]?.id
|
res.data[0].children[0].children[0].children[0].children[0]?.id
|
||||||
emit(
|
emit(
|
||||||
'init',
|
'init',
|
||||||
res.data[0].children[0].children[0].children[0].children[0]?.children[0] ||
|
res.data[0].children[0].children[0].children[0].children[0]?.children[0] ||
|
||||||
res.data[0].children[0].children[0].children[0].children[0]
|
res.data[0].children[0].children[0].children[0].children[0]
|
||||||
)
|
)
|
||||||
|
|
||||||
tree.value = res.data
|
tree.value = res.data
|
||||||
if (nodeKey) {
|
if (nodeKey) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
treeRef.value.treeRef.setCurrentKey(nodeKey)
|
treeRef.value.treeRef.setCurrentKey(nodeKey)
|
||||||
// treeRef.value.treeRef.setExpandedKeys(nodeKey)
|
|
||||||
})
|
// treeRef.value.treeRef.setExpandedKeys(nodeKey)
|
||||||
}
|
})
|
||||||
})
|
}
|
||||||
}
|
})
|
||||||
loadData()
|
}
|
||||||
</script>
|
const scrollToNode = (id: string) => {
|
||||||
<style lang="scss">
|
// 树滚动
|
||||||
.point-tree {
|
treeRef.value.scrollToNode(id)
|
||||||
height: 100%;
|
}
|
||||||
width: 100%;
|
defineExpose({ treeRef, scrollToNode, tree })
|
||||||
display: flex;
|
loadData()
|
||||||
flex-direction: column;
|
</script>
|
||||||
background: #fff;
|
<style lang="scss">
|
||||||
border: 1px solid var(--el-border-color);
|
.point-tree {
|
||||||
}
|
height: 100%;
|
||||||
</style>
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid var(--el-border-color);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="layout-logo">
|
<div class="layout-logo">
|
||||||
<img v-if="!config.layout.menuCollapse" class="logo-img" :src="getTheme.logoUrl" />
|
<img v-if="!config.layout.menuCollapse && getTheme && getTheme.logoUrl" class="logo-img" :src="getTheme.logoUrl" />
|
||||||
<!-- <div-->
|
<!-- <div-->
|
||||||
<!-- v-if="!config.layout.menuCollapse"-->
|
<!-- v-if="!config.layout.menuCollapse"-->
|
||||||
<!-- :style="{ color: config.getColorVal('menuActiveColor') }"-->
|
<!-- :style="{ color: config.getColorVal('menuActiveColor') }"-->
|
||||||
@@ -28,7 +28,9 @@ import { Session } from '@/utils/storage'
|
|||||||
import { setNavTabsWidth } from '@/utils/layout'
|
import { setNavTabsWidth } from '@/utils/layout'
|
||||||
|
|
||||||
const config = useConfig()
|
const config = useConfig()
|
||||||
const getTheme = JSON.parse(window.localStorage.getItem('getTheme') as string)
|
const getTheme = window.localStorage.getItem('getTheme')
|
||||||
|
? JSON.parse(window.localStorage.getItem('getTheme') as string)
|
||||||
|
: null
|
||||||
const onMenuCollapse = function () {
|
const onMenuCollapse = function () {
|
||||||
if (config.layout.shrink && !config.layout.menuCollapse) {
|
if (config.layout.shrink && !config.layout.menuCollapse) {
|
||||||
closeShade()
|
closeShade()
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<span class="nav-bar-title">
|
<span class="nav-bar-title">
|
||||||
{{ getTheme.name }}
|
{{ getTheme?.name || '' }}
|
||||||
<span style="font-size: 14px">({{ Version || 'v1.0.0' }})</span>
|
<span style="font-size: 14px">({{ Version || 'v1.0.0' }})</span>
|
||||||
<!-- <span style="font-size: 14px;" v-if="Version?.versionName">
|
<!-- <span style="font-size: 14px;" v-if="Version?.versionName">
|
||||||
({{ Version?.versionName }})
|
({{ Version?.versionName }})
|
||||||
@@ -28,8 +28,10 @@ import { getLastData } from '@/api/systerm'
|
|||||||
|
|
||||||
const Version: any = ref(null)
|
const Version: any = ref(null)
|
||||||
const config = useConfig()
|
const config = useConfig()
|
||||||
const getTheme = JSON.parse(window.localStorage.getItem('getTheme') as string)
|
const getTheme = window.localStorage.getItem('getTheme')
|
||||||
|
? JSON.parse(window.localStorage.getItem('getTheme') as string)
|
||||||
|
: { name: '' }
|
||||||
|
const VITE_FLAG = import.meta.env.VITE_NAME == 'hainan'
|
||||||
const onMenuCollapse = () => {
|
const onMenuCollapse = () => {
|
||||||
showShade('ba-aside-menu-shade', () => {
|
showShade('ba-aside-menu-shade', () => {
|
||||||
config.setLayout('menuCollapse', true)
|
config.setLayout('menuCollapse', true)
|
||||||
@@ -37,10 +39,13 @@ const onMenuCollapse = () => {
|
|||||||
config.setLayout('menuCollapse', false)
|
config.setLayout('menuCollapse', false)
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getLastData({ versionType: 'WEB' }).then(res => {
|
if(!VITE_FLAG){
|
||||||
Version.value = res.data.versionName
|
getLastData({ versionType: 'WEB' }).then(res => {
|
||||||
})
|
Version.value = res.data.versionName
|
||||||
document.title = getTheme.name
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
document.title = getTheme?.name || ''
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-container class="layout-container">
|
<el-container class="layout-container">
|
||||||
<Aside />
|
<Aside />
|
||||||
<el-container class="content-wrapper">
|
<el-container class="content-wrapper">
|
||||||
<Header />
|
<Header />
|
||||||
<Nav />
|
<Nav />
|
||||||
<Main />
|
<Main />
|
||||||
</el-container>
|
</el-container>
|
||||||
</el-container>
|
</el-container>
|
||||||
<CloseFullScreen v-if="navTabs.state.tabFullScreen" />
|
<CloseFullScreen v-if="navTabs.state.tabFullScreen" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Aside from '@/layouts/admin/components/aside.vue'
|
import Aside from '@/layouts/admin/components/aside.vue'
|
||||||
import Header from '@/layouts/admin/components/header.vue'
|
import Header from '@/layouts/admin/components/header.vue'
|
||||||
import Main from '@/layouts/admin/router-view/main.vue'
|
import Main from '@/layouts/admin/router-view/main.vue'
|
||||||
import CloseFullScreen from '@/layouts/admin/components/closeFullScreen.vue'
|
import CloseFullScreen from '@/layouts/admin/components/closeFullScreen.vue'
|
||||||
import { useNavTabs } from '@/stores/navTabs'
|
import { useNavTabs } from '@/stores/navTabs'
|
||||||
import Nav from '@/layouts/admin/components/nav.vue'
|
import Nav from '@/layouts/admin/components/nav.vue'
|
||||||
const navTabs = useNavTabs()
|
const navTabs = useNavTabs()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.layout-container {
|
.layout-container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.content-wrapper {
|
.content-wrapper {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,104 +1,104 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-main class="layout-main" :style="mainHeight()">
|
<el-main class="layout-main" :style="mainHeight()">
|
||||||
<router-view v-slot="{ Component }">
|
<router-view v-slot="{ Component }">
|
||||||
<transition :name="config.layout.mainAnimation" mode="out-in">
|
<transition :name="config.layout.mainAnimation" mode="out-in">
|
||||||
<keep-alive :include="state.keepAliveComponentNameList">
|
<keep-alive :include="state.keepAliveComponentNameList">
|
||||||
<component :is="Component" :key="state.componentKey" />
|
<component :is="Component" :key="state.componentKey" />
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
</transition>
|
</transition>
|
||||||
</router-view>
|
</router-view>
|
||||||
</el-main>
|
</el-main>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted, watch, onBeforeMount, onUnmounted, nextTick, provide } from 'vue'
|
import { ref, reactive, onMounted, watch, onBeforeMount, onUnmounted, nextTick, provide } from 'vue'
|
||||||
import { useRoute, type RouteLocationNormalized } from 'vue-router'
|
import { useRoute, type RouteLocationNormalized } from 'vue-router'
|
||||||
import { mainHeight } from '@/utils/layout'
|
import { mainHeight } from '@/utils/layout'
|
||||||
import useCurrentInstance from '@/utils/useCurrentInstance'
|
import useCurrentInstance from '@/utils/useCurrentInstance'
|
||||||
import { useConfig } from '@/stores/config'
|
import { useConfig } from '@/stores/config'
|
||||||
import { useNavTabs } from '@/stores/navTabs'
|
import { useNavTabs } from '@/stores/navTabs'
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'layout/main'
|
name: 'layout/main'
|
||||||
})
|
})
|
||||||
|
|
||||||
const { proxy } = useCurrentInstance()
|
const { proxy } = useCurrentInstance()
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const config = useConfig()
|
const config = useConfig()
|
||||||
const navTabs = useNavTabs()
|
const navTabs = useNavTabs()
|
||||||
|
|
||||||
const state: {
|
const state: {
|
||||||
componentKey: string
|
componentKey: string
|
||||||
keepAliveComponentNameList: string[]
|
keepAliveComponentNameList: string[]
|
||||||
} = reactive({
|
} = reactive({
|
||||||
componentKey: route.path,
|
componentKey: route.path,
|
||||||
keepAliveComponentNameList: []
|
keepAliveComponentNameList: []
|
||||||
})
|
})
|
||||||
|
|
||||||
const addKeepAliveComponentName = function (keepAliveName: string | undefined) {
|
const addKeepAliveComponentName = function (keepAliveName: string | undefined) {
|
||||||
if (keepAliveName) {
|
if (keepAliveName) {
|
||||||
let exist = state.keepAliveComponentNameList.find((name: string) => {
|
let exist = state.keepAliveComponentNameList.find((name: string) => {
|
||||||
return name === keepAliveName
|
return name === keepAliveName
|
||||||
})
|
})
|
||||||
if (exist) return
|
if (exist) return
|
||||||
state.keepAliveComponentNameList.push(keepAliveName)
|
state.keepAliveComponentNameList.push(keepAliveName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
proxy.eventBus.on('onTabViewRefresh', (menu: RouteLocationNormalized) => {
|
proxy.eventBus.on('onTabViewRefresh', (menu: RouteLocationNormalized) => {
|
||||||
state.keepAliveComponentNameList = state.keepAliveComponentNameList.filter(
|
state.keepAliveComponentNameList = state.keepAliveComponentNameList.filter(
|
||||||
(name: string) => menu.meta.keepalive !== name
|
(name: string) => menu.meta.keepalive !== name
|
||||||
)
|
)
|
||||||
state.componentKey = ''
|
state.componentKey = ''
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
state.componentKey = menu.path
|
state.componentKey = menu.path
|
||||||
addKeepAliveComponentName(menu.meta.keepalive as string)
|
addKeepAliveComponentName(menu.meta.keepalive as string)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
proxy.eventBus.on('onTabViewClose', (menu: RouteLocationNormalized) => {
|
proxy.eventBus.on('onTabViewClose', (menu: RouteLocationNormalized) => {
|
||||||
state.keepAliveComponentNameList = state.keepAliveComponentNameList.filter(
|
state.keepAliveComponentNameList = state.keepAliveComponentNameList.filter(
|
||||||
(name: string) => menu.meta.keepalive !== name
|
(name: string) => menu.meta.keepalive !== name
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
proxy.eventBus.off('onTabViewRefresh')
|
proxy.eventBus.off('onTabViewRefresh')
|
||||||
proxy.eventBus.off('onTabViewClose')
|
proxy.eventBus.off('onTabViewClose')
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 确保刷新页面时也能正确取得当前路由 keepalive 参数
|
// 确保刷新页面时也能正确取得当前路由 keepalive 参数
|
||||||
if (typeof navTabs.state.activeRoute?.meta.keepalive == 'string') {
|
if (typeof navTabs.state.activeRoute?.meta.keepalive == 'string') {
|
||||||
addKeepAliveComponentName(navTabs.state.activeRoute?.meta.keepalive)
|
addKeepAliveComponentName(navTabs.state.activeRoute?.meta.keepalive)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.path,
|
() => route.path,
|
||||||
() => {
|
() => {
|
||||||
state.componentKey = route.path
|
state.componentKey = route.path
|
||||||
if (typeof navTabs.state.activeRoute?.meta.keepalive == 'string') {
|
if (typeof navTabs.state.activeRoute?.meta.keepalive == 'string') {
|
||||||
addKeepAliveComponentName(navTabs.state.activeRoute?.meta.keepalive)
|
addKeepAliveComponentName(navTabs.state.activeRoute?.meta.keepalive)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.layout-container .layout-main {
|
.layout-container .layout-main {
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-main-scrollbar {
|
.layout-main-scrollbar {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
//overflow: hidden;
|
//overflow: hidden;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -16,12 +16,14 @@ import '@/assets/font/iconfont.css'
|
|||||||
import { ElDialog } from 'element-plus'
|
import { ElDialog } from 'element-plus'
|
||||||
import BaiduMap from 'vue-baidu-map-3x'
|
import BaiduMap from 'vue-baidu-map-3x'
|
||||||
import BaiduMapOffline from 'vue-baidu-map-offline'
|
import BaiduMapOffline from 'vue-baidu-map-offline'
|
||||||
|
|
||||||
import ExcelJS from 'exceljs'
|
import ExcelJS from 'exceljs'
|
||||||
import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx'
|
import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx'
|
||||||
// 方式1:NPM 安装,注入 ExcelJS 对象
|
// 方式1:NPM 安装,注入 ExcelJS 对象
|
||||||
VXETable.use(VXETablePluginExportXLSX, {
|
VXETable.use(VXETablePluginExportXLSX, {
|
||||||
ExcelJS
|
ExcelJS
|
||||||
})
|
})
|
||||||
|
// 全局注册 tooltip 组件
|
||||||
window.XEUtils = XEUtils
|
window.XEUtils = XEUtils
|
||||||
|
|
||||||
// 初始化多语言
|
// 初始化多语言
|
||||||
@@ -61,6 +63,7 @@ const setupAll = async () => {
|
|||||||
app.use(pinia)
|
app.use(pinia)
|
||||||
app.use(ElementPlus)
|
app.use(ElementPlus)
|
||||||
app.use(VXETable)
|
app.use(VXETable)
|
||||||
|
|
||||||
;(app._context.components.ElDialog as typeof ElDialog).props.closeOnClickModal.default = false
|
;(app._context.components.ElDialog as typeof ElDialog).props.closeOnClickModal.default = false
|
||||||
registerIcons(app) // icons
|
registerIcons(app) // icons
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ export const useDictStore = defineStore('dict', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
getDictByType(type: string) {
|
getDictByType(type: string) {
|
||||||
|
console.log("🚀 ~ type:", type)
|
||||||
if (!this.isSetDict) {
|
if (!this.isSetDict) {
|
||||||
this.setDictMap()
|
this.setDictMap()
|
||||||
}
|
}
|
||||||
|
|||||||
34
src/stores/timeCache.ts
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
// src/stores/timeCache.ts
|
||||||
|
import { defineStore } from 'pinia'
|
||||||
|
import { RouteLocationNormalizedLoaded } from 'vue-router'
|
||||||
|
|
||||||
|
// 时间组件的缓存值 用于驾驶舱放大的时候和内部的时间组件同步
|
||||||
|
interface TimeCacheState {
|
||||||
|
cache: Map<string, {
|
||||||
|
interval: number | undefined // 时间组件的月份、年份、时间、时间格式的缓存值
|
||||||
|
timeValue: any // 时间组件的值
|
||||||
|
}>
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useTimeCacheStore = defineStore('timeCache', {
|
||||||
|
state: (): TimeCacheState => ({
|
||||||
|
cache: new Map()
|
||||||
|
}),
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
setCache(routePath: string, interval: number | undefined, timeValue: any) {
|
||||||
|
this.cache.set(routePath, {
|
||||||
|
interval,
|
||||||
|
timeValue
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getCache(routePath: string) {
|
||||||
|
return this.cache.get(routePath)
|
||||||
|
},
|
||||||
|
|
||||||
|
hasCache(routePath: string) {
|
||||||
|
return this.cache.has(routePath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -373,3 +373,4 @@ body,
|
|||||||
.w-e-scroll {
|
.w-e-scroll {
|
||||||
min-height: 200px !important;
|
min-height: 200px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -268,3 +268,8 @@
|
|||||||
.el-drawer__body {
|
.el-drawer__body {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.aLoad{
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
@@ -8,29 +8,31 @@ $primary-light: #3f6ad8;
|
|||||||
// --ba-background
|
// --ba-background
|
||||||
$bg-color: () !default;
|
$bg-color: () !default;
|
||||||
$bg-color: map.merge(
|
$bg-color: map.merge(
|
||||||
(
|
(
|
||||||
'': #edf0f3,
|
'': #edf0f3,
|
||||||
'overlay': #ffffff,
|
'overlay': #ffffff
|
||||||
),
|
),
|
||||||
$bg-color
|
$bg-color
|
||||||
);
|
);
|
||||||
|
|
||||||
// --ba-border-color
|
// --ba-border-color
|
||||||
$border-color: () !default;
|
$border-color: () !default;
|
||||||
$border-color: map.merge(
|
$border-color: map.merge(
|
||||||
(
|
(
|
||||||
'': #f6f6f6,
|
'': #f6f6f6
|
||||||
),
|
),
|
||||||
$border-color
|
$border-color
|
||||||
);
|
);
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
@include set-css-var-value('main-space', $main-space);
|
@include set-css-var-value('main-space', $main-space);
|
||||||
@include set-css-var-value('color-primary-light', $primary-light);
|
@include set-css-var-value('color-primary-light', $primary-light);
|
||||||
@include set-component-css-var('bg-color', $bg-color);
|
@include set-component-css-var('bg-color', $bg-color);
|
||||||
@include set-component-css-var('border-color', $border-color);
|
@include set-component-css-var('border-color', $border-color);
|
||||||
// --vxe-table-row-current-background-color: var(--el-color-primary-light-7);
|
--vxe-ui-table-row-current-background-color: var(--el-color-primary-light-8);
|
||||||
// --vxe-table-row-hover-background-color: var(--el-color-primary-light-9);
|
--vxe-ui-table-row-hover-current-background-color: var(--el-color-primary-light-8);
|
||||||
// --vxe-table-row-hover-current-background-color: var(--el-color-primary-light-7);
|
// --vxe-table-row-current-background-color: var(--el-color-primary-light-7);
|
||||||
// --vxe-table-row-hover-striped-background-color: var(--el-color-primary-light-9);
|
// --vxe-table-row-hover-background-color: var(--el-color-primary-light-9);
|
||||||
|
// --vxe-table-row-hover-current-background-color: var(--el-color-primary-light-7);
|
||||||
|
// --vxe-table-row-hover-striped-background-color: var(--el-color-primary-light-9);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
.vxe-header--row {
|
.vxe-header--row {
|
||||||
background: var(--vxe-table-header-background-color);
|
background: var(--vxe-table-header-background-color);
|
||||||
color: var(--vxe-table-header-font-color);
|
color: var(--vxe-table-header-font-color);
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.is--checked.vxe-checkbox,
|
.is--checked.vxe-checkbox,
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
.vxe-table--render-default .is--indeterminate.vxe-cell--checkbox,
|
.vxe-table--render-default .is--indeterminate.vxe-cell--checkbox,
|
||||||
.vxe-table--render-default .is--indeterminate.vxe-cell--checkbox .vxe-checkbox--icon,
|
.vxe-table--render-default .is--indeterminate.vxe-cell--checkbox .vxe-checkbox--icon,
|
||||||
.vxe-table--render-default .is--checked.vxe-cell--radio .vxe-radio--icon {
|
.vxe-table--render-default .is--checked.vxe-cell--radio .vxe-radio--icon {
|
||||||
color: var(--el-color-primary-light-3);
|
color: var(--el-color-primary-light-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.vxe-checkbox:not(.is--disabled):hover .vxe-checkbox--icon,
|
.vxe-checkbox:not(.is--disabled):hover .vxe-checkbox--icon,
|
||||||
@@ -38,40 +38,41 @@
|
|||||||
.vxe-export--panel-column-option:not(.is--disabled):hover .vxe-radio--icon,
|
.vxe-export--panel-column-option:not(.is--disabled):hover .vxe-radio--icon,
|
||||||
.vxe-table--filter-option:not(.is--disabled):hover .vxe-radio--icon,
|
.vxe-table--filter-option:not(.is--disabled):hover .vxe-radio--icon,
|
||||||
.vxe-table--render-default .vxe-cell--radio:not(.is--disabled):hover .vxe-radio--icon {
|
.vxe-table--render-default .vxe-cell--radio:not(.is--disabled):hover .vxe-radio--icon {
|
||||||
color: var(--el-color-primary-light-5);
|
color: var(--el-color-primary-light-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.vxe-table--tooltip-wrapper {
|
.vxe-table--tooltip-wrapper {
|
||||||
z-index: 10000 !important;
|
z-index: 10000 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.is--disabled {
|
.is--disabled {
|
||||||
background-color: var(--vxe-input-disabled-color);
|
background-color: var(--vxe-input-disabled-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.vxe-modal--wrapper {
|
.vxe-modal--wrapper {
|
||||||
z-index: 5000 !important;
|
z-index: 5000 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vxe-table--body .vxe-body--row:nth-child(even) {
|
.vxe-table--body .vxe-body--row:nth-child(even) {
|
||||||
background-color: #f9f9f9;
|
background-color: #f9f9f9;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vxe-table--body .vxe-body--row:nth-child(odd) {
|
.vxe-table--body .vxe-body--row:nth-child(odd) {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.default-theme.splitpanes--vertical > .splitpanes__splitter,
|
.default-theme.splitpanes--vertical > .splitpanes__splitter,
|
||||||
.default-theme .splitpanes--vertical > .splitpanes__splitter {
|
.default-theme .splitpanes--vertical > .splitpanes__splitter {
|
||||||
width: 10px !important;
|
width: 10px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.default-theme.splitpanes--vertical > .splitpanes__splitter:after,
|
.default-theme.splitpanes--vertical > .splitpanes__splitter:after,
|
||||||
.default-theme .splitpanes--vertical > .splitpanes__splitter:after {
|
.default-theme .splitpanes--vertical > .splitpanes__splitter:after {
|
||||||
background-color: #000 !important;
|
background-color: #000 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.default-theme.splitpanes--vertical > .splitpanes__splitter:before,
|
.default-theme.splitpanes--vertical > .splitpanes__splitter:before,
|
||||||
.default-theme .splitpanes--vertical > .splitpanes__splitter:before {
|
.default-theme .splitpanes--vertical > .splitpanes__splitter:before {
|
||||||
background-color: #000 !important;
|
background-color: #000 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,10 @@
|
|||||||
.vxe-table--render-default .vxe-cell--radio:not(.is--disabled):hover .vxe-radio--icon {
|
.vxe-table--render-default .vxe-cell--radio:not(.is--disabled):hover .vxe-radio--icon {
|
||||||
color: var(--el-color-primary-light-5);
|
color: var(--el-color-primary-light-5);
|
||||||
}
|
}
|
||||||
|
.vxe-table--render-default .vxe-body--row.row--current,
|
||||||
|
.vxe-table--render-default .vxe-body--row.row--current:hover {
|
||||||
|
background-color: var(--el-color-primary-light-8);
|
||||||
|
}
|
||||||
// .vxe-table--render-default .is--disabled.vxe-cell--checkbox .vxe-checkbox--icon{
|
// .vxe-table--render-default .is--disabled.vxe-cell--checkbox .vxe-checkbox--icon{
|
||||||
// color: #fff0;
|
// color: #fff0;
|
||||||
// }
|
// }
|
||||||
@@ -77,14 +80,14 @@
|
|||||||
.vxe-modal--wrapper {
|
.vxe-modal--wrapper {
|
||||||
z-index: 5000 !important;
|
z-index: 5000 !important;
|
||||||
}
|
}
|
||||||
.vxe-table--body .vxe-body--row:nth-child(even) {
|
// .vxe-table--body .vxe-body--row:nth-child(even) {
|
||||||
background-color: #f9f9f9;
|
// background-color: #f9f9f9;
|
||||||
// background-color: var(--el-color-primary-light-9);
|
// // background-color: var(--el-color-primary-light-9);
|
||||||
}
|
// }
|
||||||
|
|
||||||
.vxe-table--body .vxe-body--row:nth-child(odd) {
|
// .vxe-table--body .vxe-body--row:nth-child(odd) {
|
||||||
background-color: #ffffff;
|
// background-color: #ffffff;
|
||||||
}
|
// }
|
||||||
.default-theme.splitpanes--vertical > .splitpanes__splitter,
|
.default-theme.splitpanes--vertical > .splitpanes__splitter,
|
||||||
.default-theme .splitpanes--vertical > .splitpanes__splitter {
|
.default-theme .splitpanes--vertical > .splitpanes__splitter {
|
||||||
width: 10px !important;
|
width: 10px !important;
|
||||||
|
|||||||
@@ -1,71 +1,70 @@
|
|||||||
import { useCache, CACHE_KEY } from '@/hooks/web/useCache'
|
import { useCache, CACHE_KEY } from '@/hooks/web/useCache'
|
||||||
import { TokenType } from '@/api/login/types'
|
import { decrypt, encrypt } from '@/utils/jsencrypt'
|
||||||
import { decrypt, encrypt } from '@/utils/jsencrypt'
|
|
||||||
|
const { wsCache } = useCache()
|
||||||
const { wsCache } = useCache()
|
|
||||||
|
const AccessTokenKey = 'ACCESS_TOKEN'
|
||||||
const AccessTokenKey = 'ACCESS_TOKEN'
|
const RefreshTokenKey = 'REFRESH_TOKEN'
|
||||||
const RefreshTokenKey = 'REFRESH_TOKEN'
|
|
||||||
|
// 获取token
|
||||||
// 获取token
|
export const getAccessToken = () => {
|
||||||
export const getAccessToken = () => {
|
// 此处与TokenKey相同,此写法解决初始化时Cookies中不存在TokenKey报错
|
||||||
// 此处与TokenKey相同,此写法解决初始化时Cookies中不存在TokenKey报错
|
return wsCache.get(AccessTokenKey) ? wsCache.get(AccessTokenKey) : wsCache.get('ACCESS_TOKEN')
|
||||||
return wsCache.get(AccessTokenKey) ? wsCache.get(AccessTokenKey) : wsCache.get('ACCESS_TOKEN')
|
}
|
||||||
}
|
|
||||||
|
// 刷新token
|
||||||
// 刷新token
|
export const getRefreshToken = () => {
|
||||||
export const getRefreshToken = () => {
|
return wsCache.get(RefreshTokenKey)
|
||||||
return wsCache.get(RefreshTokenKey)
|
}
|
||||||
}
|
|
||||||
|
// 设置token
|
||||||
// 设置token
|
export const setToken = (token: any) => {
|
||||||
export const setToken = (token: TokenType) => {
|
wsCache.set(RefreshTokenKey, token.refreshToken)
|
||||||
wsCache.set(RefreshTokenKey, token.refreshToken)
|
wsCache.set(AccessTokenKey, token.accessToken)
|
||||||
wsCache.set(AccessTokenKey, token.accessToken)
|
}
|
||||||
}
|
|
||||||
|
// 删除token
|
||||||
// 删除token
|
export const removeToken = () => {
|
||||||
export const removeToken = () => {
|
wsCache.delete(AccessTokenKey)
|
||||||
wsCache.delete(AccessTokenKey)
|
wsCache.delete(RefreshTokenKey)
|
||||||
wsCache.delete(RefreshTokenKey)
|
}
|
||||||
}
|
|
||||||
|
/** 格式化token(jwt格式) */
|
||||||
/** 格式化token(jwt格式) */
|
export const formatToken = (token: string): string => {
|
||||||
export const formatToken = (token: string): string => {
|
return 'Bearer ' + token
|
||||||
return 'Bearer ' + token
|
}
|
||||||
}
|
// ========== 账号相关 ==========
|
||||||
// ========== 账号相关 ==========
|
|
||||||
|
export type LoginFormType = {
|
||||||
export type LoginFormType = {
|
tenantName: string
|
||||||
tenantName: string
|
username: string
|
||||||
username: string
|
password: string
|
||||||
password: string
|
rememberMe: boolean
|
||||||
rememberMe: boolean
|
}
|
||||||
}
|
|
||||||
|
export const getLoginForm = () => {
|
||||||
export const getLoginForm = () => {
|
const loginForm: LoginFormType = wsCache.get(CACHE_KEY.LoginForm)
|
||||||
const loginForm: LoginFormType = wsCache.get(CACHE_KEY.LoginForm)
|
if (loginForm) {
|
||||||
if (loginForm) {
|
loginForm.password = decrypt(loginForm.password) as string
|
||||||
loginForm.password = decrypt(loginForm.password) as string
|
}
|
||||||
}
|
return loginForm
|
||||||
return loginForm
|
}
|
||||||
}
|
|
||||||
|
export const setLoginForm = (loginForm: LoginFormType) => {
|
||||||
export const setLoginForm = (loginForm: LoginFormType) => {
|
loginForm.password = encrypt(loginForm.password) as string
|
||||||
loginForm.password = encrypt(loginForm.password) as string
|
wsCache.set(CACHE_KEY.LoginForm, loginForm, { exp: 30 * 24 * 60 * 60 })
|
||||||
wsCache.set(CACHE_KEY.LoginForm, loginForm, { exp: 30 * 24 * 60 * 60 })
|
}
|
||||||
}
|
|
||||||
|
export const removeLoginForm = () => {
|
||||||
export const removeLoginForm = () => {
|
wsCache.delete(CACHE_KEY.LoginForm)
|
||||||
wsCache.delete(CACHE_KEY.LoginForm)
|
}
|
||||||
}
|
|
||||||
|
// ========== 租户相关 ==========
|
||||||
// ========== 租户相关 ==========
|
|
||||||
|
export const getTenantId = () => {
|
||||||
export const getTenantId = () => {
|
return wsCache.get(CACHE_KEY.TenantId)
|
||||||
return wsCache.get(CACHE_KEY.TenantId)
|
}
|
||||||
}
|
|
||||||
|
export const setTenantId = (username: string) => {
|
||||||
export const setTenantId = (username: string) => {
|
wsCache.set(CACHE_KEY.TenantId, username)
|
||||||
wsCache.set(CACHE_KEY.TenantId, username)
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ export const getIntDictOptions = (dictType: string): NumberDictDataType[] => {
|
|||||||
value: parseInt(dict.value + '')
|
value: parseInt(dict.value + '')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
console.log("🚀 ~ getIntDictOptions ~ dictOption:", dictOption)
|
||||||
return dictOption
|
return dictOption
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,159 +1,302 @@
|
|||||||
const dataProcessing = (arr: any[]) => {
|
const dataProcessing = (arr: any[]) => {
|
||||||
return arr
|
return arr
|
||||||
.filter(item => typeof item === 'number' || (typeof item === 'string' && !isNaN(parseFloat(item))))
|
.filter(item => typeof item === 'number' || (typeof item === 'string' && !isNaN(parseFloat(item))))
|
||||||
.map(item => (typeof item === 'number' ? item : parseFloat(item)))
|
.map(item => (typeof item === 'number' ? item : parseFloat(item)))
|
||||||
}
|
}
|
||||||
const calculateValue = (o: number, value: number, num: number, isMin: boolean) => {
|
const calculateValue = (o: number, value: number, num: number, isMin: boolean) => {
|
||||||
if (value === 0) {
|
if (value === 0) {
|
||||||
return 0
|
return 0
|
||||||
} else if (value > 0 && Math.abs(value) < 1 && isMin == true) {
|
} else if (value > 0 && Math.abs(value) < 1 && isMin == true) {
|
||||||
return 0
|
return 0
|
||||||
} else if (value > -1 && value < 0 && isMin == false) {
|
} else if (value > -1 && value < 0 && isMin == false) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
let base
|
let base
|
||||||
if (Math.abs(o) >= 100) {
|
if (Math.abs(o) >= 100) {
|
||||||
base = 100
|
base = 100
|
||||||
} else if (Math.abs(o) >= 10) {
|
} else if (Math.abs(o) >= 10) {
|
||||||
base = 10
|
base = 10
|
||||||
} else if (Math.abs(o) >= 1) {
|
} else if (Math.abs(o) >= 1) {
|
||||||
base = 1
|
base = 1
|
||||||
} else {
|
} else {
|
||||||
base = 0.1
|
base = 0.1
|
||||||
}
|
}
|
||||||
let calculatedValue
|
let calculatedValue
|
||||||
if (isMin) {
|
if (isMin) {
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
calculatedValue = value + num * value
|
calculatedValue = value + num * value
|
||||||
} else {
|
} else {
|
||||||
calculatedValue = value - num * value
|
calculatedValue = value - num * value
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
calculatedValue = value - num * value
|
calculatedValue = value - num * value
|
||||||
} else {
|
} else {
|
||||||
calculatedValue = value + num * value
|
calculatedValue = value + num * value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (base === 0.1) {
|
if (base === 0.1) {
|
||||||
return parseFloat(calculatedValue.toFixed(1))
|
return parseFloat(calculatedValue.toFixed(1))
|
||||||
} else if (isMin) {
|
} else if (isMin) {
|
||||||
return Math.floor(calculatedValue / base) * base
|
return Math.floor(calculatedValue / base) * base
|
||||||
} else {
|
} else {
|
||||||
return Math.ceil(calculatedValue / base) * base
|
return Math.ceil(calculatedValue / base) * base
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理y轴最大最小值
|
// 处理y轴最大最小值
|
||||||
export const yMethod = (arr: any) => {
|
export const yMethod = (arr: any) => {
|
||||||
let num = 0.1
|
let num = 0.1
|
||||||
let numList = dataProcessing(arr)
|
let numList = dataProcessing(arr)
|
||||||
let maxValue = 0
|
let maxValue = 0
|
||||||
let minValue = 0
|
let minValue = 0
|
||||||
let max = 0
|
let max = 0
|
||||||
let min = 0
|
let min = 0
|
||||||
maxValue = Math.max(...numList)
|
maxValue = Math.max(...numList)
|
||||||
minValue = Math.min(...numList)
|
minValue = Math.min(...numList)
|
||||||
const o = maxValue - minValue
|
const o = maxValue - minValue
|
||||||
if (Math.abs(o) >= 300) {
|
if (Math.abs(o) >= 300) {
|
||||||
num = 0.02
|
num = 0.02
|
||||||
}
|
}
|
||||||
|
|
||||||
min = calculateValue(o, minValue, num, true)
|
min = calculateValue(o, minValue, num, true)
|
||||||
max = calculateValue(o, maxValue, num, false)
|
max = calculateValue(o, maxValue, num, false)
|
||||||
// if (-100 >= minValue) {
|
// if (-100 >= minValue) {
|
||||||
// min = Math.floor((minValue + num * minValue) / 100) * 100
|
// min = Math.floor((minValue + num * minValue) / 100) * 100
|
||||||
// } else if (-10 >= minValue && minValue > -100) {
|
// } else if (-10 >= minValue && minValue > -100) {
|
||||||
// min = Math.floor((minValue + num * minValue) / 10) * 10
|
// min = Math.floor((minValue + num * minValue) / 10) * 10
|
||||||
// } else if (-1 >= minValue && minValue > -10) {
|
// } else if (-1 >= minValue && minValue > -10) {
|
||||||
// min = Math.floor(minValue + num * minValue)
|
// min = Math.floor(minValue + num * minValue)
|
||||||
// } else if (0 > minValue && minValue > -1) {
|
// } else if (0 > minValue && minValue > -1) {
|
||||||
// min = parseFloat((minValue + num * minValue).toFixed(1))
|
// min = parseFloat((minValue + num * minValue).toFixed(1))
|
||||||
// } else if (minValue == 0) {
|
// } else if (minValue == 0) {
|
||||||
// min = 0
|
// min = 0
|
||||||
// } else if (0 < minValue && minValue < 1) {
|
// } else if (0 < minValue && minValue < 1) {
|
||||||
// min = parseFloat((minValue - num * minValue).toFixed(1))
|
// min = parseFloat((minValue - num * minValue).toFixed(1))
|
||||||
// } else if (1 <= minValue && minValue < 10) {
|
// } else if (1 <= minValue && minValue < 10) {
|
||||||
// min = Math.floor(minValue - num * minValue)
|
// min = Math.floor(minValue - num * minValue)
|
||||||
// } else if (10 <= minValue && minValue < 100) {
|
// } else if (10 <= minValue && minValue < 100) {
|
||||||
// min = Math.floor((minValue - num * minValue) / 10) * 10
|
// min = Math.floor((minValue - num * minValue) / 10) * 10
|
||||||
// } else if (100 <= minValue) {
|
// } else if (100 <= minValue) {
|
||||||
// min = Math.floor((minValue - num * minValue) / 100) * 100
|
// min = Math.floor((minValue - num * minValue) / 100) * 100
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if (-100 >= maxValue) {
|
// if (-100 >= maxValue) {
|
||||||
// max = Math.ceil((maxValue - num * maxValue) / 100) * 100
|
// max = Math.ceil((maxValue - num * maxValue) / 100) * 100
|
||||||
// } else if (-10 >= maxValue && maxValue > -100) {
|
// } else if (-10 >= maxValue && maxValue > -100) {
|
||||||
// max = Math.ceil((maxValue - num * maxValue) / 10) * 10
|
// max = Math.ceil((maxValue - num * maxValue) / 10) * 10
|
||||||
// } else if (-1 >= maxValue && maxValue > -10) {
|
// } else if (-1 >= maxValue && maxValue > -10) {
|
||||||
// max = Math.ceil(maxValue - num * maxValue)
|
// max = Math.ceil(maxValue - num * maxValue)
|
||||||
// } else if (0 > maxValue && maxValue > -1) {
|
// } else if (0 > maxValue && maxValue > -1) {
|
||||||
// max = parseFloat((maxValue - num * maxValue).toFixed(1))
|
// max = parseFloat((maxValue - num * maxValue).toFixed(1))
|
||||||
// } else if (maxValue == 0) {
|
// } else if (maxValue == 0) {
|
||||||
// max = 0
|
// max = 0
|
||||||
// } else if (0 < maxValue && maxValue < 1) {
|
// } else if (0 < maxValue && maxValue < 1) {
|
||||||
// max = parseFloat((maxValue + num * maxValue).toFixed(1))
|
// max = parseFloat((maxValue + num * maxValue).toFixed(1))
|
||||||
// } else if (1 <= maxValue && maxValue < 10) {
|
// } else if (1 <= maxValue && maxValue < 10) {
|
||||||
// max = Math.ceil(maxValue + num * maxValue)
|
// max = Math.ceil(maxValue + num * maxValue)
|
||||||
// } else if (10 <= maxValue && maxValue < 100) {
|
// } else if (10 <= maxValue && maxValue < 100) {
|
||||||
// max = Math.ceil((maxValue + num * maxValue) / 10) * 10
|
// max = Math.ceil((maxValue + num * maxValue) / 10) * 10
|
||||||
// } else if (100 <= maxValue) {
|
// } else if (100 <= maxValue) {
|
||||||
// max = Math.ceil((maxValue + num * maxValue) / 100) * 100
|
// max = Math.ceil((maxValue + num * maxValue) / 100) * 100
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if (maxValue > 1000 || minValue < -1000) {
|
// if (maxValue > 1000 || minValue < -1000) {
|
||||||
// max = Math.ceil(maxValue / 100) * 100
|
// max = Math.ceil(maxValue / 100) * 100
|
||||||
// if (minValue == 0) {
|
// if (minValue == 0) {
|
||||||
// min = 0
|
// min = 0
|
||||||
// } else {
|
// } else {
|
||||||
// min = Math.floor(minValue / 100) * 100
|
// min = Math.floor(minValue / 100) * 100
|
||||||
// }
|
// }
|
||||||
// } else if (maxValue < 60 && minValue > 40) {
|
// } else if (maxValue < 60 && minValue > 40) {
|
||||||
// max = 60
|
// max = 60
|
||||||
// min = 40
|
// min = 40
|
||||||
// } else if (maxValue == minValue && maxValue < 10 && minValue > 0) {
|
// } else if (maxValue == minValue && maxValue < 10 && minValue > 0) {
|
||||||
// max = Math.ceil(maxValue / 10) * 10
|
// max = Math.ceil(maxValue / 10) * 10
|
||||||
// min = Math.floor(minValue / 10) * 10
|
// min = Math.floor(minValue / 10) * 10
|
||||||
// } else if (maxValue == minValue && maxValue != 0 && minValue != 0) {
|
// } else if (maxValue == minValue && maxValue != 0 && minValue != 0) {
|
||||||
// max = Math.ceil(maxValue / 10 + 1) * 10
|
// max = Math.ceil(maxValue / 10 + 1) * 10
|
||||||
// min = Math.floor(minValue / 10 - 1) * 10
|
// min = Math.floor(minValue / 10 - 1) * 10
|
||||||
// } else {
|
// } else {
|
||||||
// max = Math.ceil(maxValue / 10) * 10
|
// max = Math.ceil(maxValue / 10) * 10
|
||||||
// min = Math.floor(minValue / 10) * 10
|
// min = Math.floor(minValue / 10) * 10
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if (maxValue > 0 && maxValue < 1) {
|
// if (maxValue > 0 && maxValue < 1) {
|
||||||
// max = 1
|
// max = 1
|
||||||
// } else if (max == 0 && minValue > -1 && minValue < 0) {
|
// } else if (max == 0 && minValue > -1 && minValue < 0) {
|
||||||
// min = -1
|
// min = -1
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return [min, max]
|
return [min, max]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* title['A相','B相',]
|
* title['A相','B相',]
|
||||||
* data[[1,2],[3,4]]
|
* data[[1,2],[3,4]]
|
||||||
*/
|
*/
|
||||||
// 导出csv文件
|
// 导出csv文件
|
||||||
const convertToCSV = (title: object, data: any) => {
|
const convertToCSV = (title: object, data: any) => {
|
||||||
console.log('🚀 ~ convertToCSV ~ data:', data)
|
console.log('🚀 ~ convertToCSV ~ data:', data)
|
||||||
let csv = ''
|
let csv = ''
|
||||||
// 添加列头
|
// 添加列头
|
||||||
csv += ',' + title.join(',') + '\n'
|
csv += ',' + title.join(',') + '\n'
|
||||||
// 遍历数据并添加到CSV字符串中
|
// 遍历数据并添加到CSV字符串中
|
||||||
data?.map(item => {
|
data?.map(item => {
|
||||||
csv += item.join(',') + '\n'
|
csv += item.join(',') + '\n'
|
||||||
})
|
})
|
||||||
return csv
|
return csv
|
||||||
}
|
}
|
||||||
export const exportCSV = (title: object, data: any, filename: string) => {
|
export const exportCSV = (title: object, data: any, filename: string) => {
|
||||||
const csv = convertToCSV(title, data)
|
const csv = convertToCSV(title, data)
|
||||||
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' })
|
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' })
|
||||||
const link = document.createElement('a')
|
const link = document.createElement('a')
|
||||||
link.href = URL.createObjectURL(blob)
|
link.href = URL.createObjectURL(blob)
|
||||||
link.download = filename
|
link.download = filename
|
||||||
link.click()
|
link.click()
|
||||||
// 释放URL对象
|
// 释放URL对象
|
||||||
URL.revokeObjectURL(link.href)
|
URL.revokeObjectURL(link.href)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 补全时间序列数据中缺失的条目
|
||||||
|
* @param rawData 原始数据,格式为 [["时间字符串", "数值", "单位", "类型"], ...]
|
||||||
|
* @returns 补全后的数据,缺失条目数值为 null
|
||||||
|
*/
|
||||||
|
export const completeTimeSeries = (rawData: string[][]): (string | null)[][] => {
|
||||||
|
// 步骤1:校验原始数据并解析时间
|
||||||
|
if (rawData.length < 2) {
|
||||||
|
console.warn('数据量不足2条,无法计算时间间隔,直接返回原始数据')
|
||||||
|
return rawData.map(item => [...item])
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析所有时间为Date对象,过滤无效时间并按时间排序
|
||||||
|
const validData = rawData
|
||||||
|
.map(item => {
|
||||||
|
// 确保至少有时间和数值字段
|
||||||
|
if (!item[0]) {
|
||||||
|
return { time: new Date(0), item, isValid: false }
|
||||||
|
}
|
||||||
|
const time = new Date(item[0])
|
||||||
|
return { time, item, isValid: !isNaN(time.getTime()) }
|
||||||
|
})
|
||||||
|
.filter(data => data.isValid)
|
||||||
|
.sort((a, b) => a.time.getTime() - b.time.getTime()) // 确保数据按时间排序
|
||||||
|
.map(data => data.item)
|
||||||
|
|
||||||
|
if (validData.length < 2) {
|
||||||
|
throw new Error('有效时间数据不足2条,无法继续处理')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 步骤2:计算时间间隔(分析前几条数据确定最可能的间隔)
|
||||||
|
const intervals: number[] = []
|
||||||
|
// 分析前10条数据来确定间隔,避免单一间隔出错
|
||||||
|
const analyzeCount = Math.min(10, validData.length - 1)
|
||||||
|
for (let i = 0; i < analyzeCount; i++) {
|
||||||
|
const currentTime = new Date(validData[i][0]!).getTime()
|
||||||
|
const nextTime = new Date(validData[i + 1][0]!).getTime()
|
||||||
|
const interval = nextTime - currentTime
|
||||||
|
if (interval > 0) {
|
||||||
|
intervals.push(interval)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取最常见的间隔作为标准间隔
|
||||||
|
const timeInterval = getMostFrequentValue(intervals)
|
||||||
|
if (timeInterval <= 0) {
|
||||||
|
throw new Error('无法确定有效的时间间隔')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 步骤3:生成完整的时间序列范围(从第一条到最后一条)
|
||||||
|
const startTime = new Date(validData[0][0]!).getTime()
|
||||||
|
const endTime = new Date(validData[validData.length - 1][0]!).getTime()
|
||||||
|
const completeTimes: Date[] = []
|
||||||
|
|
||||||
|
// 生成从 startTime 到 endTime 的所有间隔时间点
|
||||||
|
for (let time = startTime; time <= endTime; time += timeInterval) {
|
||||||
|
completeTimes.push(new Date(time))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 步骤4:将原始数据转为时间映射表,使用精确的时间字符串匹配
|
||||||
|
const timeDataMap = new Map<string, (string | undefined)[]>()
|
||||||
|
validData.forEach(item => {
|
||||||
|
// 使用原始时间字符串作为键,避免格式转换导致的匹配问题
|
||||||
|
if (item[0]) {
|
||||||
|
timeDataMap.set(item[0], item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 提取模板数据(从第一条有效数据中提取单位和类型,处理可能的缺失)
|
||||||
|
const template = validData[0]
|
||||||
|
|
||||||
|
// 步骤5:对比补全数据,缺失条目数值为 null
|
||||||
|
const completedData = completeTimes.map(time => {
|
||||||
|
// 保持与原始数据相同的时间格式
|
||||||
|
const timeStr = formatTime(time)
|
||||||
|
const existingItem = timeDataMap.get(timeStr)
|
||||||
|
|
||||||
|
if (existingItem) {
|
||||||
|
// 存在该时间,返回原始数据
|
||||||
|
return [...existingItem]
|
||||||
|
} else {
|
||||||
|
// 缺失该时间,数值设为 null,其他字段沿用第一个有效数据的格式
|
||||||
|
// 处理可能缺失的单位和类型字段
|
||||||
|
const result: (string | null | undefined)[] = [timeStr, '/']
|
||||||
|
// 仅在原始数据有单位字段时才添加
|
||||||
|
if (template.length > 2) {
|
||||||
|
result.push(template[2])
|
||||||
|
}
|
||||||
|
// 仅在原始数据有类型字段时才添加
|
||||||
|
if (template.length > 3) {
|
||||||
|
result.push(template[3])
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return completedData
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化时间为 "YYYY-MM-DD HH:mm:ss" 格式
|
||||||
|
* @param date 日期对象
|
||||||
|
* @returns 格式化后的时间字符串
|
||||||
|
*/
|
||||||
|
function formatTime(date: Date): string {
|
||||||
|
const year = date.getFullYear()
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||||
|
const day = String(date.getDate()).padStart(2, '0')
|
||||||
|
const hours = String(date.getHours()).padStart(2, '0')
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, '0')
|
||||||
|
const seconds = String(date.getSeconds()).padStart(2, '0')
|
||||||
|
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数组中出现频率最高的值
|
||||||
|
* @param arr 数字数组
|
||||||
|
* @returns 出现频率最高的值
|
||||||
|
*/
|
||||||
|
function getMostFrequentValue(arr: number[]): number {
|
||||||
|
if (arr.length === 0) return 0
|
||||||
|
|
||||||
|
const frequencyMap = new Map<number, number>()
|
||||||
|
arr.forEach(num => {
|
||||||
|
frequencyMap.set(num, (frequencyMap.get(num) || 0) + 1)
|
||||||
|
})
|
||||||
|
|
||||||
|
let maxFrequency = 0
|
||||||
|
let mostFrequent = arr[0]
|
||||||
|
|
||||||
|
frequencyMap.forEach((frequency, num) => {
|
||||||
|
if (frequency > maxFrequency) {
|
||||||
|
maxFrequency = frequency
|
||||||
|
mostFrequent = num
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return mostFrequent
|
||||||
|
}
|
||||||
|
|||||||
91
src/utils/fileDownLoad.ts
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
import { downloadFile } from '@/api/system-boot/file'
|
||||||
|
// 下载文件
|
||||||
|
export const download = (urls: string) => {
|
||||||
|
//console.log('下载', urls)
|
||||||
|
|
||||||
|
downloadFile({ filePath: urls })
|
||||||
|
.then((res: any) => {
|
||||||
|
// 1. 确定文件MIME类型(优化:用更简洁的方式)
|
||||||
|
const getFileType = (url: string) => {
|
||||||
|
const ext = url.split('.').pop()?.toLowerCase() || ''
|
||||||
|
const mimeMap: Record<string, string> = {
|
||||||
|
pdf: 'application/pdf',
|
||||||
|
zip: 'application/zip',
|
||||||
|
doc: 'application/msword',
|
||||||
|
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||||
|
xls: 'application/vnd.ms-excel',
|
||||||
|
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||||
|
png: 'image/png',
|
||||||
|
jpeg: 'image/jpeg',
|
||||||
|
jpg: 'image/jpg'
|
||||||
|
}
|
||||||
|
return mimeMap[ext] || ''
|
||||||
|
}
|
||||||
|
|
||||||
|
const blob = new Blob([res], { type: getFileType(urls) })
|
||||||
|
|
||||||
|
// 2. 提取文件名并保留原生后缀(核心修复点)
|
||||||
|
const fileName = urls.split('/').at(-1) || '下载文件' // 先提取URL最后一段(文件名)
|
||||||
|
|
||||||
|
// 3. 创建下载链接
|
||||||
|
const url = window.URL.createObjectURL(blob)
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = url
|
||||||
|
link.download = fileName // 直接使用原文件名(保留后缀)
|
||||||
|
document.body.appendChild(link)
|
||||||
|
link.click()
|
||||||
|
|
||||||
|
// 4. 清理资源(优化)
|
||||||
|
link.remove()
|
||||||
|
window.URL.revokeObjectURL(url) // 释放blob URL
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error('下载失败:', err)
|
||||||
|
// 可添加错误提示(如Toast)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function removeLastDotSuffix(str: string) {
|
||||||
|
// 找到最后一个 . 的位置
|
||||||
|
const lastDotIndex = str.lastIndexOf('.')
|
||||||
|
// 如果存在 .,截取到 . 之前的部分;否则返回原字符串
|
||||||
|
return lastDotIndex !== -1 ? str.slice(0, lastDotIndex) : str
|
||||||
|
}
|
||||||
|
|
||||||
|
// 预览文件
|
||||||
|
export const previewFile = async (urls: any) => {
|
||||||
|
//console.log('预览', urls)
|
||||||
|
let url = ''
|
||||||
|
//console.log('urls', decodeURI(urls))
|
||||||
|
await downloadFile({ filePath: decodeURI(urls) })
|
||||||
|
.then((res: any) => {
|
||||||
|
|
||||||
|
// 1. 确定文件MIME类型(优化:用更简洁的方式)
|
||||||
|
const getFileType = (url: string) => {
|
||||||
|
const ext = url.split('.').pop()?.toLowerCase() || ''
|
||||||
|
const mimeMap: Record<string, string> = {
|
||||||
|
pdf: 'application/pdf',
|
||||||
|
zip: 'application/zip',
|
||||||
|
doc: 'application/msword',
|
||||||
|
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||||
|
xls: 'application/vnd.ms-excel',
|
||||||
|
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||||
|
png: 'image/png',
|
||||||
|
jpeg: 'image/jpeg',
|
||||||
|
jpg: 'image/jpg'
|
||||||
|
}
|
||||||
|
return mimeMap[ext] || ''
|
||||||
|
}
|
||||||
|
|
||||||
|
const blob = new Blob([res], { type: getFileType(decodeURI(urls)) })
|
||||||
|
|
||||||
|
|
||||||
|
// 3. 创建下载链接
|
||||||
|
url = window.URL.createObjectURL(blob)
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error('下载失败:', err)
|
||||||
|
// 可添加错误提示(如Toast)
|
||||||
|
})
|
||||||
|
//console.log('url', url)
|
||||||
|
return url
|
||||||
|
}
|
||||||
@@ -362,3 +362,4 @@ export function getTimeOfTheMonth(key: string): [string, string] {
|
|||||||
throw new Error('Invalid key')
|
throw new Error('Invalid key')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,104 +1,114 @@
|
|||||||
// 页面气泡效果
|
// 页面气泡效果
|
||||||
|
|
||||||
const bubble: {
|
const bubble: {
|
||||||
width: number
|
width: number
|
||||||
height: number
|
height: number
|
||||||
bubbleEl: any
|
bubbleEl: any
|
||||||
canvas: any
|
canvas: any
|
||||||
ctx: any
|
ctx: any
|
||||||
circles: any[]
|
circles: any[]
|
||||||
animate: boolean
|
animate: boolean
|
||||||
requestId: any
|
requestId: any
|
||||||
} = {
|
} = {
|
||||||
width: 0,
|
width: 0,
|
||||||
height: 0,
|
height: 0,
|
||||||
bubbleEl: null,
|
bubbleEl: null,
|
||||||
canvas: null,
|
canvas: null,
|
||||||
ctx: {},
|
ctx: {},
|
||||||
circles: [],
|
circles: [],
|
||||||
animate: true,
|
animate: true,
|
||||||
requestId: null,
|
requestId: null
|
||||||
}
|
}
|
||||||
|
|
||||||
export const init = function (): void {
|
export const init = function (): void {
|
||||||
bubble.width = window.innerWidth
|
bubble.width = window.innerWidth
|
||||||
bubble.height = window.innerHeight
|
bubble.height = window.innerHeight
|
||||||
|
|
||||||
bubble.bubbleEl = document.getElementById('bubble')
|
bubble.bubbleEl = document.getElementById('bubble')
|
||||||
bubble.bubbleEl.style.height = bubble.height + 'px'
|
bubble.bubbleEl.style.height = bubble.height + 'px'
|
||||||
|
|
||||||
bubble.canvas = document.getElementById('bubble-canvas')
|
bubble.canvas = document.getElementById('bubble-canvas')
|
||||||
bubble.canvas.width = bubble.width
|
bubble.canvas.width = bubble.width
|
||||||
bubble.canvas.height = bubble.height
|
bubble.canvas.height = bubble.height
|
||||||
bubble.ctx = bubble.canvas.getContext('2d')
|
bubble.ctx = bubble.canvas.getContext('2d')
|
||||||
|
|
||||||
// create particles
|
// create particles
|
||||||
bubble.circles = []
|
bubble.circles = []
|
||||||
for (let x = 0; x < bubble.width * 0.5; x++) {
|
for (let x = 0; x < bubble.width * 0.5; x++) {
|
||||||
const c = new Circle()
|
const c = new Circle()
|
||||||
bubble.circles.push(c)
|
bubble.circles.push(c)
|
||||||
}
|
}
|
||||||
animate()
|
animate()
|
||||||
addListeners()
|
addListeners()
|
||||||
}
|
}
|
||||||
|
|
||||||
function scrollCheck() {
|
function scrollCheck() {
|
||||||
bubble.animate = document.body.scrollTop > bubble.height ? false : true
|
bubble.animate = document.body.scrollTop > bubble.height ? false : true
|
||||||
}
|
}
|
||||||
|
|
||||||
function resize() {
|
function resize() {
|
||||||
bubble.width = window.innerWidth
|
bubble.width = window.innerWidth
|
||||||
bubble.height = window.innerHeight
|
bubble.height = window.innerHeight
|
||||||
bubble.bubbleEl.style.height = bubble.height + 'px'
|
bubble.bubbleEl.style.height = bubble.height + 'px'
|
||||||
bubble.canvas.width = bubble.width
|
bubble.canvas.width = bubble.width
|
||||||
bubble.canvas.height = bubble.height
|
bubble.canvas.height = bubble.height
|
||||||
}
|
}
|
||||||
|
|
||||||
function animate() {
|
function animate() {
|
||||||
if (bubble.animate) {
|
if (bubble.animate) {
|
||||||
bubble.ctx.clearRect(0, 0, bubble.width, bubble.height)
|
bubble.ctx.clearRect(0, 0, bubble.width, bubble.height)
|
||||||
for (const i in bubble.circles) {
|
for (const i in bubble.circles) {
|
||||||
bubble.circles[i].draw()
|
bubble.circles[i].draw()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bubble.requestId = requestAnimationFrame(animate)
|
bubble.requestId = requestAnimationFrame(animate)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Circle {
|
class Circle {
|
||||||
pos: {
|
pos: {
|
||||||
x: number
|
x: number
|
||||||
y: number
|
y: number
|
||||||
}
|
}
|
||||||
alpha: number
|
alpha: number
|
||||||
scale: number
|
scale: number
|
||||||
velocity: number
|
velocity: number
|
||||||
draw: () => void
|
draw: () => void
|
||||||
constructor() {
|
constructor() {
|
||||||
this.pos = {
|
this.pos = {
|
||||||
x: Math.random() * bubble.width,
|
x: Math.random() * bubble.width,
|
||||||
y: bubble.height + Math.random() * 100,
|
y: bubble.height + Math.random() * 100
|
||||||
}
|
}
|
||||||
this.alpha = 0.1 + Math.random() * 0.3
|
this.alpha = 0.1 + Math.random() * 0.3
|
||||||
this.scale = 0.1 + Math.random() * 0.3
|
this.scale = 0.1 + Math.random() * 0.3
|
||||||
this.velocity = Math.random()
|
this.velocity = Math.random()
|
||||||
this.draw = function () {
|
this.draw = function () {
|
||||||
this.pos.y -= this.velocity
|
this.pos.y -= this.velocity
|
||||||
this.alpha -= 0.0005
|
this.alpha -= 0.0005
|
||||||
bubble.ctx.beginPath()
|
// 当气泡超出顶部或透明度为 0 时,重置位置和属性
|
||||||
bubble.ctx.arc(this.pos.x, this.pos.y, this.scale * 10, 0, 2 * Math.PI, false)
|
if (this.pos.y < -10 || this.alpha < 0) {
|
||||||
bubble.ctx.fillStyle = 'rgba(255,255,255,' + this.alpha + ')'
|
this.pos = {
|
||||||
bubble.ctx.fill()
|
x: Math.random() * bubble.width,
|
||||||
}
|
y: bubble.height + Math.random() * 100
|
||||||
}
|
}
|
||||||
}
|
this.alpha = 0.1 + Math.random() * 0.35
|
||||||
|
this.scale = 0.1 + Math.random() * 0.35
|
||||||
function addListeners() {
|
this.velocity = Math.random()
|
||||||
window.addEventListener('scroll', scrollCheck)
|
}
|
||||||
window.addEventListener('resize', resize)
|
bubble.ctx.beginPath()
|
||||||
}
|
bubble.ctx.arc(this.pos.x, this.pos.y, this.scale * 10, 0, 2 * Math.PI, false)
|
||||||
|
bubble.ctx.fillStyle = 'rgba(255,255,255,' + this.alpha + ')'
|
||||||
export function removeListeners() {
|
bubble.ctx.fill()
|
||||||
window.removeEventListener('scroll', scrollCheck)
|
}
|
||||||
window.removeEventListener('resize', resize)
|
}
|
||||||
cancelAnimationFrame(bubble.requestId)
|
}
|
||||||
}
|
|
||||||
|
function addListeners() {
|
||||||
|
window.addEventListener('scroll', scrollCheck)
|
||||||
|
window.addEventListener('resize', resize)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function removeListeners() {
|
||||||
|
window.removeEventListener('scroll', scrollCheck)
|
||||||
|
window.removeEventListener('resize', resize)
|
||||||
|
cancelAnimationFrame(bubble.requestId)
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,326 +1,327 @@
|
|||||||
import type { AxiosRequestConfig, Method } from 'axios'
|
import type { AxiosRequestConfig, Method } from 'axios'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { ElLoading, ElNotification, type LoadingOptions } from 'element-plus'
|
import { ElLoading, ElNotification, type LoadingOptions } from 'element-plus'
|
||||||
import { refreshToken } from '@/api/user-boot/user'
|
import { refreshToken } from '@/api/user-boot/user'
|
||||||
import router from '@/router/index'
|
import router from '@/router/index'
|
||||||
import { useAdminInfo } from '@/stores/adminInfo'
|
import { useAdminInfo } from '@/stores/adminInfo'
|
||||||
import { debounce } from 'lodash-es';
|
import { debounce } from 'lodash-es'
|
||||||
let loginExpireTimer:any = null
|
let loginExpireTimer: any = null
|
||||||
window.requests = []
|
window.requests = []
|
||||||
window.tokenRefreshing = false
|
window.tokenRefreshing = false
|
||||||
const pendingMap = new Map()
|
const pendingMap = new Map()
|
||||||
const loadingInstance: LoadingInstance = {
|
const loadingInstance: LoadingInstance = {
|
||||||
target: null,
|
target: null,
|
||||||
count: 0
|
count: 0
|
||||||
}
|
}
|
||||||
const VITE_FLAG = import.meta.env.VITE_NAME == 'removeMode'
|
const VITE_FLAG = import.meta.env.VITE_NAME == 'removeMode'
|
||||||
// console.log('🚀 ~ import.meta.env.VITE_NAME:', import.meta.env.VITE_NAME)
|
// console.log('🚀 ~ import.meta.env.VITE_NAME:', import.meta.env.VITE_NAME)
|
||||||
/**
|
/**
|
||||||
* 根据运行环境获取基础请求URL
|
* 根据运行环境获取基础请求URL
|
||||||
*/
|
*/
|
||||||
export const getUrl = (): string => {
|
export const getUrl = (): string => {
|
||||||
return '/api'
|
return '/api'
|
||||||
}
|
}
|
||||||
function removeBeforeSecondSlash(str: string) {
|
function removeBeforeSecondSlash(str: string) {
|
||||||
// 找到第一个斜杠的位置
|
// 找到第一个斜杠的位置
|
||||||
const firstSlashIndex = str.indexOf('/')
|
const firstSlashIndex = str.indexOf('/')
|
||||||
if (firstSlashIndex === -1) {
|
if (firstSlashIndex === -1) {
|
||||||
// 如果没有斜杠,返回原字符串
|
// 如果没有斜杠,返回原字符串
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
// 从第一个斜杠之后开始找第二个斜杠
|
// 从第一个斜杠之后开始找第二个斜杠
|
||||||
const secondSlashIndex = str.indexOf('/', firstSlashIndex + 1)
|
const secondSlashIndex = str.indexOf('/', firstSlashIndex + 1)
|
||||||
if (secondSlashIndex === -1) {
|
if (secondSlashIndex === -1) {
|
||||||
// 如果只有一个斜杠,返回原字符串
|
// 如果只有一个斜杠,返回原字符串
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
// 返回第二个斜杠及之后的内容
|
// 返回第二个斜杠及之后的内容
|
||||||
return str.substring(secondSlashIndex)
|
return str.substring(secondSlashIndex)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 创建`Axios`
|
* 创建`Axios`
|
||||||
* 默认开启`reductDataFormat(简洁响应)`,返回类型为`ApiPromise`
|
* 默认开启`reductDataFormat(简洁响应)`,返回类型为`ApiPromise`
|
||||||
* 关闭`reductDataFormat`,返回类型则为`AxiosPromise`
|
* 关闭`reductDataFormat`,返回类型则为`AxiosPromise`
|
||||||
*/
|
*/
|
||||||
function createAxios<Data = any, T = ApiPromise<Data>>(
|
function createAxios<Data = any, T = ApiPromise<Data>>(
|
||||||
axiosConfig: AxiosRequestConfig,
|
axiosConfig: AxiosRequestConfig,
|
||||||
options: Options = {},
|
options: Options = {},
|
||||||
loading: LoadingOptions = {}
|
loading: LoadingOptions = {}
|
||||||
): T {
|
): T {
|
||||||
const adminInfo = useAdminInfo()
|
const adminInfo = useAdminInfo()
|
||||||
|
|
||||||
const Axios = axios.create({
|
const Axios = axios.create({
|
||||||
baseURL: getUrl(),
|
baseURL: getUrl(),
|
||||||
timeout: 1000 * 60 * 5,
|
timeout: 1000 * 60 * 5,
|
||||||
headers: {},
|
headers: {},
|
||||||
responseType: 'json'
|
responseType: 'json'
|
||||||
})
|
})
|
||||||
|
|
||||||
options = Object.assign(
|
options = Object.assign(
|
||||||
{
|
{
|
||||||
CancelDuplicateRequest: true, // 是否开启取消重复请求, 默认为 true
|
CancelDuplicateRequest: true, // 是否开启取消重复请求, 默认为 true
|
||||||
loading: false, // 是否开启loading层效果, 默认为false
|
loading: false, // 是否开启loading层效果, 默认为false
|
||||||
reductDataFormat: true, // 是否开启简洁的数据结构响应, 默认为true
|
reductDataFormat: true, // 是否开启简洁的数据结构响应, 默认为true
|
||||||
showErrorMessage: true, // 是否开启接口错误信息展示,默认为true
|
showErrorMessage: true, // 是否开启接口错误信息展示,默认为true
|
||||||
showCodeMessage: true, // 是否开启code不为1时的信息提示, 默认为true
|
showCodeMessage: true, // 是否开启code不为1时的信息提示, 默认为true
|
||||||
showSuccessMessage: false, // 是否开启code为1时的信息提示, 默认为false
|
showSuccessMessage: false, // 是否开启code为1时的信息提示, 默认为false
|
||||||
anotherToken: '' // 当前请求使用另外的用户token
|
anotherToken: '' // 当前请求使用另外的用户token
|
||||||
},
|
},
|
||||||
options
|
options
|
||||||
)
|
)
|
||||||
|
|
||||||
// 请求拦截
|
// 请求拦截
|
||||||
Axios.interceptors.request.use(
|
Axios.interceptors.request.use(
|
||||||
async (config: any) => {
|
async (config: any) => {
|
||||||
//嵌入去除所有请求头
|
//嵌入去除所有请求头
|
||||||
if (VITE_FLAG) {
|
if (VITE_FLAG) {
|
||||||
config.url = await removeBeforeSecondSlash(config.url)
|
config.url = await removeBeforeSecondSlash(config.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消重复请求
|
// 取消重复请求
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!(
|
!(
|
||||||
config.url == '/system-boot/file/upload' ||
|
config.url == '/system-boot/file/upload' ||
|
||||||
config.url == '/harmonic-boot/grid/getAssessOverview' ||
|
config.url == '/harmonic-boot/grid/getAssessOverview' ||
|
||||||
config.url == '/system-boot/file/getFileVO' ||
|
config.url == '/system-boot/file/getFileVO' ||
|
||||||
config.url == '/harmonic-boot/gridDiagram/getGridDiagramAreaData'
|
config.url == '/harmonic-boot/gridDiagram/getGridDiagramAreaData' ||
|
||||||
)
|
config.url == '/supervision-boot/userReport/bindAssessmentId'
|
||||||
)
|
)
|
||||||
removePending(config)
|
)
|
||||||
|
removePending(config)
|
||||||
options.CancelDuplicateRequest && addPending(config)
|
|
||||||
// 创建loading实例
|
options.CancelDuplicateRequest && addPending(config)
|
||||||
if (options.loading) {
|
// 创建loading实例
|
||||||
loadingInstance.count++
|
if (options.loading) {
|
||||||
if (loadingInstance.count === 1) {
|
loadingInstance.count++
|
||||||
loadingInstance.target = ElLoading.service(loading)
|
if (loadingInstance.count === 1) {
|
||||||
}
|
loadingInstance.target = ElLoading.service(loading)
|
||||||
}
|
}
|
||||||
// 自动携带token
|
}
|
||||||
if (config.headers) {
|
// 自动携带token
|
||||||
const token = adminInfo.getToken()
|
if (config.headers) {
|
||||||
if (token) {
|
const token = adminInfo.getToken()
|
||||||
;(config.headers as anyObj).Authorization = token
|
if (token) {
|
||||||
} else {
|
;(config.headers as anyObj).Authorization = token
|
||||||
config.headers.Authorization = 'Basic bmpjbnRlc3Q6bmpjbnBxcw=='
|
} else {
|
||||||
}
|
config.headers.Authorization = 'Basic bmpjbnRlc3Q6bmpjbnBxcw=='
|
||||||
}
|
}
|
||||||
if (config.url == '/user-boot/user/generateSm2Key' || config.url == '/pqs-auth/oauth/token') {
|
}
|
||||||
config.headers.Authorization = 'Basic bmpjbnRlc3Q6bmpjbnBxcw=='
|
if (config.url == '/user-boot/user/generateSm2Key' || config.url == '/pqs-auth/oauth/token') {
|
||||||
}
|
config.headers.Authorization = 'Basic bmpjbnRlc3Q6bmpjbnBxcw=='
|
||||||
|
}
|
||||||
return config
|
|
||||||
},
|
return config
|
||||||
error => {
|
},
|
||||||
return Promise.reject(error)
|
error => {
|
||||||
}
|
return Promise.reject(error)
|
||||||
)
|
}
|
||||||
|
)
|
||||||
// 响应拦截
|
|
||||||
Axios.interceptors.response.use(
|
// 响应拦截
|
||||||
response => {
|
Axios.interceptors.response.use(
|
||||||
removePending(response.config)
|
response => {
|
||||||
options.loading && closeLoading(options) // 关闭loading
|
removePending(response.config)
|
||||||
|
options.loading && closeLoading(options) // 关闭loading
|
||||||
if (
|
|
||||||
response.data.code === 'A0000' ||
|
if (
|
||||||
response.data.type === 'application/json' ||
|
response.data.code === 'A0000' ||
|
||||||
Array.isArray(response.data) ||
|
response.data.type === 'application/json' ||
|
||||||
response.data.size ||
|
Array.isArray(response.data) ||
|
||||||
response.config.url == '/harmonic-boot/exportmodel/exportModelJB' ||
|
response.data.size ||
|
||||||
response.config.url == '/system-boot/file/download' ||
|
response.config.url == '/harmonic-boot/exportmodel/exportModelJB' ||
|
||||||
response.config.url == '/harmonic-boot/powerStatistics/exportExcelListTemplate' ||
|
response.config.url == '/system-boot/file/download' ||
|
||||||
response.config.url == '/harmonic-boot/powerStatistics/exportExcelRangTemplate'
|
response.config.url == '/harmonic-boot/powerStatistics/exportExcelListTemplate' ||
|
||||||
// ||
|
response.config.url == '/harmonic-boot/powerStatistics/exportExcelRangTemplate'
|
||||||
// response.data.type === 'application/octet-stream' ||
|
// ||
|
||||||
// response.data.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
// response.data.type === 'application/octet-stream' ||
|
||||||
) {
|
// response.data.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||||
return options.reductDataFormat ? response.data : response
|
) {
|
||||||
} else if (response.data.code == 'A0202') {
|
return options.reductDataFormat ? response.data : response
|
||||||
if (!window.tokenRefreshing) {
|
} else if (response.data.code == 'A0202') {
|
||||||
window.tokenRefreshing = true
|
if (!window.tokenRefreshing) {
|
||||||
|
window.tokenRefreshing = true
|
||||||
return refreshToken()
|
|
||||||
.then(res => {
|
return refreshToken()
|
||||||
adminInfo.setToken(res.data.access_token, 'auth')
|
.then(res => {
|
||||||
window.requests.forEach(cb => cb(res.data.access_token))
|
adminInfo.setToken(res.data.access_token, 'auth')
|
||||||
window.requests = []
|
window.requests.forEach(cb => cb(res.data.access_token))
|
||||||
|
window.requests = []
|
||||||
return Axios(response.config)
|
|
||||||
})
|
return Axios(response.config)
|
||||||
.catch(err => {
|
})
|
||||||
adminInfo.removeToken()
|
.catch(err => {
|
||||||
router.push({ name: 'login' })
|
adminInfo.removeToken()
|
||||||
return Promise.reject(err)
|
router.push({ name: 'login' })
|
||||||
})
|
return Promise.reject(err)
|
||||||
.finally(() => {
|
})
|
||||||
window.tokenRefreshing = false
|
.finally(() => {
|
||||||
})
|
window.tokenRefreshing = false
|
||||||
} else {
|
})
|
||||||
return new Promise(resolve => {
|
} else {
|
||||||
// 用函数形式将 resolve 存入,等待刷新后再执行
|
return new Promise(resolve => {
|
||||||
window.requests.push((token: string) => {
|
// 用函数形式将 resolve 存入,等待刷新后再执行
|
||||||
response.headers.Authorization = `${token}`
|
window.requests.push((token: string) => {
|
||||||
resolve(Axios(response.config))
|
response.headers.Authorization = `${token}`
|
||||||
})
|
resolve(Axios(response.config))
|
||||||
})
|
})
|
||||||
}
|
})
|
||||||
} else if (response.data.code == 'A0024' || response.data.code == 'null') {
|
}
|
||||||
// // 登录失效
|
} else if (response.data.code == 'A0024' || response.data.code == 'null') {
|
||||||
// 清除上一次的定时器
|
// // 登录失效
|
||||||
if (loginExpireTimer) {
|
// 清除上一次的定时器
|
||||||
clearTimeout(loginExpireTimer)
|
if (loginExpireTimer) {
|
||||||
}
|
clearTimeout(loginExpireTimer)
|
||||||
loginExpireTimer = setTimeout(() => {
|
}
|
||||||
ElNotification({
|
loginExpireTimer = setTimeout(() => {
|
||||||
type: 'error',
|
ElNotification({
|
||||||
message: response.data.message
|
type: 'error',
|
||||||
})
|
message: response.data.message
|
||||||
adminInfo.removeToken()
|
})
|
||||||
router.push({ name: 'login' })
|
adminInfo.removeToken()
|
||||||
loginExpireTimer = null // 执行后清空定时器
|
router.push({ name: 'login' })
|
||||||
}, 100) // 可根据实际情况调整延迟时间
|
loginExpireTimer = null // 执行后清空定时器
|
||||||
return Promise.reject(response.data)
|
}, 100) // 可根据实际情况调整延迟时间
|
||||||
} else {
|
return Promise.reject(response.data)
|
||||||
if (options.showCodeMessage) {
|
} else {
|
||||||
ElNotification({
|
if (options.showCodeMessage) {
|
||||||
type: 'error',
|
ElNotification({
|
||||||
message: response.data.message || '未知错误'
|
type: 'error',
|
||||||
})
|
message: response.data.message || '未知错误'
|
||||||
}
|
})
|
||||||
return Promise.reject(response.data)
|
}
|
||||||
}
|
return Promise.reject(response.data)
|
||||||
},
|
}
|
||||||
error => {
|
},
|
||||||
error.config && removePending(error.config)
|
error => {
|
||||||
options.loading && closeLoading(options) // 关闭loading
|
error.config && removePending(error.config)
|
||||||
return Promise.reject(error) // 错误继续返回给到具体页面
|
options.loading && closeLoading(options) // 关闭loading
|
||||||
}
|
return Promise.reject(error) // 错误继续返回给到具体页面
|
||||||
)
|
}
|
||||||
return Axios(axiosConfig) as T
|
)
|
||||||
}
|
return Axios(axiosConfig) as T
|
||||||
|
}
|
||||||
export default createAxios
|
|
||||||
|
export default createAxios
|
||||||
/**
|
|
||||||
* 关闭Loading层实例
|
/**
|
||||||
*/
|
* 关闭Loading层实例
|
||||||
function closeLoading(options: Options) {
|
*/
|
||||||
if (options.loading && loadingInstance.count > 0) loadingInstance.count--
|
function closeLoading(options: Options) {
|
||||||
if (loadingInstance.count === 0) {
|
if (options.loading && loadingInstance.count > 0) loadingInstance.count--
|
||||||
loadingInstance.target.close()
|
if (loadingInstance.count === 0) {
|
||||||
loadingInstance.target = null
|
loadingInstance.target.close()
|
||||||
}
|
loadingInstance.target = null
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
|
||||||
* 储存每个请求的唯一cancel回调, 以此为标识
|
/**
|
||||||
*/
|
* 储存每个请求的唯一cancel回调, 以此为标识
|
||||||
function addPending(config: AxiosRequestConfig) {
|
*/
|
||||||
const pendingKey = getPendingKey(config)
|
function addPending(config: AxiosRequestConfig) {
|
||||||
config.cancelToken =
|
const pendingKey = getPendingKey(config)
|
||||||
config.cancelToken ||
|
config.cancelToken =
|
||||||
new axios.CancelToken(cancel => {
|
config.cancelToken ||
|
||||||
if (!pendingMap.has(pendingKey)) {
|
new axios.CancelToken(cancel => {
|
||||||
pendingMap.set(pendingKey, cancel)
|
if (!pendingMap.has(pendingKey)) {
|
||||||
}
|
pendingMap.set(pendingKey, cancel)
|
||||||
})
|
}
|
||||||
}
|
})
|
||||||
|
}
|
||||||
/**
|
|
||||||
* 删除重复的请求
|
/**
|
||||||
*/
|
* 删除重复的请求
|
||||||
function removePending(config: AxiosRequestConfig) {
|
*/
|
||||||
const pendingKey = getPendingKey(config)
|
function removePending(config: AxiosRequestConfig) {
|
||||||
if (pendingMap.has(pendingKey)) {
|
const pendingKey = getPendingKey(config)
|
||||||
const cancelToken = pendingMap.get(pendingKey)
|
if (pendingMap.has(pendingKey)) {
|
||||||
cancelToken(pendingKey)
|
const cancelToken = pendingMap.get(pendingKey)
|
||||||
pendingMap.delete(pendingKey)
|
cancelToken(pendingKey)
|
||||||
}
|
pendingMap.delete(pendingKey)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
|
||||||
* 生成每个请求的唯一key
|
/**
|
||||||
*/
|
* 生成每个请求的唯一key
|
||||||
function getPendingKey(config: AxiosRequestConfig) {
|
*/
|
||||||
let { data } = config
|
function getPendingKey(config: AxiosRequestConfig) {
|
||||||
const { url, method, params, headers } = config
|
let { data } = config
|
||||||
if (typeof data === 'string') data = JSON.parse(data) // response里面返回的config.data是个字符串对象
|
const { url, method, params, headers } = config
|
||||||
return [
|
if (typeof data === 'string') data = JSON.parse(data) // response里面返回的config.data是个字符串对象
|
||||||
url,
|
return [
|
||||||
method,
|
url,
|
||||||
headers && (headers as anyObj).Authorization ? (headers as anyObj).Authorization : '',
|
method,
|
||||||
headers && (headers as anyObj)['ba-user-token'] ? (headers as anyObj)['ba-user-token'] : '',
|
headers && (headers as anyObj).Authorization ? (headers as anyObj).Authorization : '',
|
||||||
JSON.stringify(params),
|
headers && (headers as anyObj)['ba-user-token'] ? (headers as anyObj)['ba-user-token'] : '',
|
||||||
JSON.stringify(data)
|
JSON.stringify(params),
|
||||||
].join('&')
|
JSON.stringify(data)
|
||||||
}
|
].join('&')
|
||||||
|
}
|
||||||
/**
|
|
||||||
* 根据请求方法组装请求数据/参数
|
/**
|
||||||
*/
|
* 根据请求方法组装请求数据/参数
|
||||||
export function requestPayload(method: Method, data: anyObj, paramsPOST: boolean) {
|
*/
|
||||||
if (method == 'GET') {
|
export function requestPayload(method: Method, data: anyObj, paramsPOST: boolean) {
|
||||||
return {
|
if (method == 'GET') {
|
||||||
params: data
|
return {
|
||||||
}
|
params: data
|
||||||
} else if (method == 'POST') {
|
}
|
||||||
if (paramsPOST) {
|
} else if (method == 'POST') {
|
||||||
return { params: data }
|
if (paramsPOST) {
|
||||||
} else {
|
return { params: data }
|
||||||
return { data: data }
|
} else {
|
||||||
}
|
return { data: data }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 适配器, 用于适配不同的请求方式
|
}
|
||||||
export function baseRequest(url, value = {}, method = 'post', options = {}) {
|
// 适配器, 用于适配不同的请求方式
|
||||||
url = sysConfig.API_URL + url
|
export function baseRequest(url, value = {}, method = 'post', options = {}) {
|
||||||
if (method === 'post') {
|
url = sysConfig.API_URL + url
|
||||||
return service.post(url, value, options)
|
if (method === 'post') {
|
||||||
} else if (method === 'get') {
|
return service.post(url, value, options)
|
||||||
return service.get(url, { params: value, ...options })
|
} else if (method === 'get') {
|
||||||
} else if (method === 'formdata') {
|
return service.get(url, { params: value, ...options })
|
||||||
// form-data表单提交的方式
|
} else if (method === 'formdata') {
|
||||||
return service.post(url, qs.stringify(value), {
|
// form-data表单提交的方式
|
||||||
headers: {
|
return service.post(url, qs.stringify(value), {
|
||||||
'Content-Type': 'multipart/form-data'
|
headers: {
|
||||||
},
|
'Content-Type': 'multipart/form-data'
|
||||||
...options
|
},
|
||||||
})
|
...options
|
||||||
} else {
|
})
|
||||||
// 其他请求方式,例如:put、delete
|
} else {
|
||||||
return service({
|
// 其他请求方式,例如:put、delete
|
||||||
method: method,
|
return service({
|
||||||
url: url,
|
method: method,
|
||||||
data: value,
|
url: url,
|
||||||
...options
|
data: value,
|
||||||
})
|
...options
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
// 模块内的请求, 会自动加上模块的前缀
|
}
|
||||||
export const moduleRequest =
|
// 模块内的请求, 会自动加上模块的前缀
|
||||||
moduleUrl =>
|
export const moduleRequest =
|
||||||
(url, ...arg) => {
|
moduleUrl =>
|
||||||
return baseRequest(moduleUrl + url, ...arg)
|
(url, ...arg) => {
|
||||||
}
|
return baseRequest(moduleUrl + url, ...arg)
|
||||||
|
}
|
||||||
interface LoadingInstance {
|
|
||||||
target: any
|
interface LoadingInstance {
|
||||||
count: number
|
target: any
|
||||||
}
|
count: number
|
||||||
|
}
|
||||||
interface Options {
|
|
||||||
// 是否开启取消重复请求, 默认为 true
|
interface Options {
|
||||||
CancelDuplicateRequest?: boolean
|
// 是否开启取消重复请求, 默认为 true
|
||||||
// 是否开启loading层效果, 默认为false
|
CancelDuplicateRequest?: boolean
|
||||||
loading?: boolean
|
// 是否开启loading层效果, 默认为false
|
||||||
// 是否开启简洁的数据结构响应, 默认为true
|
loading?: boolean
|
||||||
reductDataFormat?: boolean
|
// 是否开启简洁的数据结构响应, 默认为true
|
||||||
// 是否开启code不为A0000时的信息提示, 默认为true
|
reductDataFormat?: boolean
|
||||||
showCodeMessage?: boolean
|
// 是否开启code不为A0000时的信息提示, 默认为true
|
||||||
// 是否开启code为0时的信息提示, 默认为false
|
showCodeMessage?: boolean
|
||||||
showSuccessMessage?: boolean
|
// 是否开启code为0时的信息提示, 默认为false
|
||||||
// 当前请求使用另外的用户token
|
showSuccessMessage?: boolean
|
||||||
anotherToken?: string
|
// 当前请求使用另外的用户token
|
||||||
}
|
anotherToken?: string
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,295 +1,331 @@
|
|||||||
import router from '@/router/index'
|
import router from '@/router/index'
|
||||||
import { isNavigationFailure, NavigationFailureType } from 'vue-router'
|
import { isNavigationFailure, NavigationFailureType } from 'vue-router'
|
||||||
import type { RouteRecordRaw, RouteLocationRaw } from 'vue-router'
|
import type { RouteRecordRaw, RouteLocationRaw } from 'vue-router'
|
||||||
import { ElNotification } from 'element-plus'
|
import { ElNotification } from 'element-plus'
|
||||||
import { useConfig } from '@/stores/config'
|
import { useConfig } from '@/stores/config'
|
||||||
import { useNavTabs } from '@/stores/navTabs'
|
import { useNavTabs } from '@/stores/navTabs'
|
||||||
import { closeShade } from '@/utils/pageShade'
|
import { closeShade } from '@/utils/pageShade'
|
||||||
import { adminBaseRoute } from '@/router/static'
|
import { adminBaseRoute } from '@/router/static'
|
||||||
import { compact, isEmpty, reverse } from 'lodash-es'
|
import { compact, isEmpty, reverse } from 'lodash-es'
|
||||||
import { isAdminApp } from '@/utils/common'
|
import { getRouteMenu, dictDataCache } from '@/api/auth'
|
||||||
|
import { isAdminApp } from '@/utils/common'
|
||||||
/**
|
import { adminBaseRoutePath } from '@/router/static'
|
||||||
* 导航失败有错误消息的路由push
|
const route:any = useRouter()
|
||||||
* @param to — 导航位置,同 router.push
|
/**
|
||||||
*/
|
* 导航失败有错误消息的路由push
|
||||||
export const routePush = async (to: RouteLocationRaw) => {
|
* @param to — 导航位置,同 router.push
|
||||||
try {
|
*/
|
||||||
const failure = await router.push(to)
|
export const routePush = async (to: RouteLocationRaw) => {
|
||||||
if (isNavigationFailure(failure, NavigationFailureType.aborted)) {
|
try {
|
||||||
ElNotification({
|
const failure = await router.push(to)
|
||||||
message: 'utils.Navigation failed, navigation guard intercepted!',
|
if (isNavigationFailure(failure, NavigationFailureType.aborted)) {
|
||||||
type: 'error'
|
ElNotification({
|
||||||
})
|
message: 'utils.Navigation failed, navigation guard intercepted!',
|
||||||
} else if (isNavigationFailure(failure, NavigationFailureType.duplicated)) {
|
type: 'error'
|
||||||
// ElNotification({
|
})
|
||||||
// message: '已在目标页',
|
} else if (isNavigationFailure(failure, NavigationFailureType.duplicated)) {
|
||||||
// type: 'warning'
|
// ElNotification({
|
||||||
// })
|
// message: '已在目标页',
|
||||||
}
|
// type: 'warning'
|
||||||
} catch (error) {
|
// })
|
||||||
ElNotification({
|
}
|
||||||
message: '导航失败,路由无效',
|
} catch (error) {
|
||||||
type: 'error'
|
ElNotification({
|
||||||
})
|
message: '导航失败,路由无效',
|
||||||
console.error(error)
|
type: 'error'
|
||||||
}
|
})
|
||||||
}
|
console.error(error)
|
||||||
|
}
|
||||||
/**
|
}
|
||||||
* 获取第一个菜单
|
|
||||||
*/
|
/**
|
||||||
export const getFirstRoute = (routes: RouteRecordRaw[], menuType = 'tab'): false | RouteRecordRaw => {
|
* 获取第一个菜单
|
||||||
const routerPaths: string[] = []
|
*/
|
||||||
const routers = router.getRoutes()
|
export const getFirstRoute = (routes: RouteRecordRaw[], menuType = 'tab'): false | RouteRecordRaw => {
|
||||||
routers.forEach(item => {
|
const routerPaths: string[] = []
|
||||||
if (item.path) routerPaths.push(item.path)
|
const routers = router.getRoutes()
|
||||||
})
|
routers.forEach(item => {
|
||||||
let find: boolean | RouteRecordRaw = false
|
if (item.path) routerPaths.push(item.path)
|
||||||
for (const key in routes) {
|
})
|
||||||
if (
|
let find: boolean | RouteRecordRaw = false
|
||||||
routes[key].meta?.type == 'menu' &&
|
for (const key in routes) {
|
||||||
routes[key].meta?.menu_type == menuType &&
|
if (
|
||||||
routerPaths.indexOf(routes[key].path) !== -1
|
routes[key].meta?.type == 'menu' &&
|
||||||
) {
|
routes[key].meta?.menu_type == menuType &&
|
||||||
return routes[key]
|
routerPaths.indexOf(routes[key].path) !== -1
|
||||||
} else if (routes[key].children && routes[key].children?.length) {
|
) {
|
||||||
find = getFirstRoute(routes[key].children!)
|
return routes[key]
|
||||||
if (find) return find
|
} else if (routes[key].children && routes[key].children?.length) {
|
||||||
}
|
find = getFirstRoute(routes[key].children!)
|
||||||
}
|
if (find) return find
|
||||||
return find
|
}
|
||||||
}
|
}
|
||||||
|
return find
|
||||||
/**
|
}
|
||||||
* 打开侧边菜单
|
|
||||||
* @param menu 菜单数据
|
/**
|
||||||
*/
|
* 打开侧边菜单
|
||||||
export const onClickMenu = (menu: RouteRecordRaw) => {
|
* @param menu 菜单数据
|
||||||
switch (menu.meta?.menu_type) {
|
*/
|
||||||
case 'iframe':
|
export const onClickMenu = (menu: RouteRecordRaw) => {
|
||||||
case 'tab':
|
switch (menu.meta?.menu_type) {
|
||||||
routePush({ path: menu.path })
|
case 'iframe':
|
||||||
break
|
case 'tab':
|
||||||
case 'link':
|
routePush({ path: menu.path })
|
||||||
window.open(menu.path, '_blank')
|
break
|
||||||
break
|
case 'link':
|
||||||
|
window.open(menu.path, '_blank')
|
||||||
default:
|
break
|
||||||
ElNotification({
|
|
||||||
message: 'utils.Navigation failed, the menu type is unrecognized!',
|
default:
|
||||||
type: 'error'
|
ElNotification({
|
||||||
})
|
message: 'utils.Navigation failed, the menu type is unrecognized!',
|
||||||
break
|
type: 'error'
|
||||||
}
|
})
|
||||||
|
break
|
||||||
const config = useConfig()
|
}
|
||||||
if (config.layout.shrink) {
|
|
||||||
closeShade(() => {
|
const config = useConfig()
|
||||||
config.setLayout('menuCollapse', true)
|
if (config.layout.shrink) {
|
||||||
})
|
closeShade(() => {
|
||||||
}
|
config.setLayout('menuCollapse', true)
|
||||||
}
|
})
|
||||||
|
}
|
||||||
/**
|
}
|
||||||
* 处理后台的路由
|
|
||||||
*/
|
/**
|
||||||
export const handleAdminRoute = (routes: any) => {
|
* 处理后台的路由
|
||||||
const viewsComponent = import.meta.glob('/src/views/**/*.vue')
|
*/
|
||||||
addRouteAll(viewsComponent, routes, adminBaseRoute.name as string)
|
export const handleAdminRoute = (routes: any) => {
|
||||||
const menuAdminBaseRoute = (adminBaseRoute.path as string) + '/'
|
const viewsComponent = import.meta.glob('/src/views/**/*.vue')
|
||||||
// 更新stores中的路由菜单数据
|
addRouteAll(viewsComponent, routes, adminBaseRoute.name as string)
|
||||||
const navTabs = useNavTabs()
|
const menuAdminBaseRoute = (adminBaseRoute.path as string) + '/'
|
||||||
navTabs.setTabsViewRoutes(handleMenuRule(routes, menuAdminBaseRoute))
|
// 更新stores中的路由菜单数据
|
||||||
navTabs.fillAuthNode(handleAuthNode(routes, menuAdminBaseRoute))
|
const navTabs = useNavTabs()
|
||||||
}
|
navTabs.setTabsViewRoutes(handleMenuRule(routes, menuAdminBaseRoute))
|
||||||
|
navTabs.fillAuthNode(handleAuthNode(routes, menuAdminBaseRoute))
|
||||||
/**
|
}
|
||||||
* 获取菜单的paths
|
|
||||||
*/
|
/**
|
||||||
export const getMenuPaths = (menus: RouteRecordRaw[]): string[] => {
|
* 获取菜单的paths
|
||||||
let menuPaths: string[] = []
|
*/
|
||||||
menus.forEach(item => {
|
export const getMenuPaths = (menus: RouteRecordRaw[]): string[] => {
|
||||||
menuPaths.push(item.path)
|
let menuPaths: string[] = []
|
||||||
if (item.children && item.children.length > 0) {
|
menus.forEach(item => {
|
||||||
menuPaths = menuPaths.concat(getMenuPaths(item.children))
|
menuPaths.push(item.path)
|
||||||
}
|
if (item.children && item.children.length > 0) {
|
||||||
})
|
menuPaths = menuPaths.concat(getMenuPaths(item.children))
|
||||||
return menuPaths
|
}
|
||||||
}
|
})
|
||||||
|
return menuPaths
|
||||||
/**
|
}
|
||||||
* 后台的菜单处理
|
|
||||||
*/
|
/**
|
||||||
const handleMenuRule = (routes: any, pathPrefix = '/', type = ['menu', 'menu_dir']) => {
|
* 后台的菜单处理
|
||||||
const menuRule: RouteRecordRaw[] = []
|
*/
|
||||||
for (const key in routes) {
|
const handleMenuRule = (routes: any, pathPrefix = '/', type = ['menu', 'menu_dir']) => {
|
||||||
if (routes[key].extend == 'add_rules_only') {
|
const menuRule: RouteRecordRaw[] = []
|
||||||
continue
|
for (const key in routes) {
|
||||||
}
|
if (routes[key].extend == 'add_rules_only') {
|
||||||
if (!type.includes(routes[key].type)) {
|
continue
|
||||||
continue
|
}
|
||||||
}
|
if (!type.includes(routes[key].type)) {
|
||||||
if (routes[key].type == 'menu_dir' && routes[key].children && !routes[key].children.length) {
|
continue
|
||||||
continue
|
}
|
||||||
}
|
if (routes[key].type == 'menu_dir' && routes[key].children && !routes[key].children.length) {
|
||||||
if (
|
continue
|
||||||
['route', 'menu', 'nav_user_menu', 'nav'].includes(routes[key].type) &&
|
}
|
||||||
((routes[key].menu_type == 'tab' && !routes[key].component) ||
|
if (
|
||||||
(['link', 'iframe'].includes(routes[key].menu_type) && !routes[key].url))
|
['route', 'menu', 'nav_user_menu', 'nav'].includes(routes[key].type) &&
|
||||||
) {
|
((routes[key].menu_type == 'tab' && !routes[key].component) ||
|
||||||
continue
|
(['link', 'iframe'].includes(routes[key].menu_type) && !routes[key].url))
|
||||||
}
|
) {
|
||||||
const currentPath = ['link', 'iframe'].includes(routes[key].menu_type)
|
continue
|
||||||
? routes[key].url
|
}
|
||||||
: pathPrefix + routes[key].path
|
const currentPath = ['link', 'iframe'].includes(routes[key].menu_type)
|
||||||
let children: RouteRecordRaw[] = []
|
? routes[key].url
|
||||||
if (routes[key].children && routes[key].children.length > 0) {
|
: pathPrefix + routes[key].path
|
||||||
children = handleMenuRule(routes[key].children, pathPrefix, type)
|
let children: RouteRecordRaw[] = []
|
||||||
}
|
if (routes[key].children && routes[key].children.length > 0) {
|
||||||
menuRule.push({
|
children = handleMenuRule(routes[key].children, pathPrefix, type)
|
||||||
path: currentPath,
|
}
|
||||||
name: routes[key].name,
|
menuRule.push({
|
||||||
component: routes[key].component,
|
path: currentPath,
|
||||||
meta: {
|
name: routes[key].name,
|
||||||
id: routes[key].id,
|
component: routes[key].component,
|
||||||
title: routes[key].title,
|
meta: {
|
||||||
icon: routes[key].icon,
|
id: routes[key].id,
|
||||||
keepalive: routes[key].keepalive,
|
title: routes[key].title,
|
||||||
menu_type: routes[key].menu_type,
|
icon: routes[key].icon,
|
||||||
type: routes[key].type
|
keepalive: routes[key].keepalive,
|
||||||
},
|
menu_type: routes[key].menu_type,
|
||||||
children: children
|
type: routes[key].type
|
||||||
})
|
},
|
||||||
}
|
children: children
|
||||||
return menuRule
|
})
|
||||||
}
|
}
|
||||||
|
return menuRule
|
||||||
/**
|
}
|
||||||
* 处理权限节点
|
|
||||||
* @param routes 路由数据
|
/**
|
||||||
* @param prefix 节点前缀
|
* 处理权限节点
|
||||||
* @returns 组装好的权限节点
|
* @param routes 路由数据
|
||||||
*/
|
* @param prefix 节点前缀
|
||||||
const handleAuthNode = (routes: any, prefix = '/') => {
|
* @returns 组装好的权限节点
|
||||||
const authNode: Map<string, string[]> = new Map([])
|
*/
|
||||||
assembleAuthNode(routes, authNode, prefix, prefix)
|
const handleAuthNode = (routes: any, prefix = '/') => {
|
||||||
return authNode
|
const authNode: Map<string, string[]> = new Map([])
|
||||||
}
|
assembleAuthNode(routes, authNode, prefix, prefix)
|
||||||
const assembleAuthNode = (routes: any, authNode: Map<string, string[]>, prefix = '/', parent = '/') => {
|
return authNode
|
||||||
const authNodeTemp = []
|
}
|
||||||
for (const key in routes) {
|
const assembleAuthNode = (routes: any, authNode: Map<string, string[]>, prefix = '/', parent = '/') => {
|
||||||
if (routes[key].type == 'button') authNodeTemp.push(prefix + routes[key].name)
|
const authNodeTemp = []
|
||||||
if (routes[key].children && routes[key].children.length > 0) {
|
for (const key in routes) {
|
||||||
assembleAuthNode(routes[key].children, authNode, prefix, prefix + routes[key].name)
|
if (routes[key].type == 'button') authNodeTemp.push(prefix + routes[key].name)
|
||||||
}
|
if (routes[key].children && routes[key].children.length > 0) {
|
||||||
}
|
assembleAuthNode(routes[key].children, authNode, prefix, prefix + routes[key].name)
|
||||||
if (authNodeTemp && authNodeTemp.length > 0) {
|
}
|
||||||
authNode.set(parent, authNodeTemp)
|
}
|
||||||
}
|
if (authNodeTemp && authNodeTemp.length > 0) {
|
||||||
}
|
authNode.set(parent, authNodeTemp)
|
||||||
|
}
|
||||||
/**
|
}
|
||||||
* 动态添加路由-带子路由
|
|
||||||
* @param viewsComponent
|
/**
|
||||||
* @param routes
|
* 动态添加路由-带子路由
|
||||||
* @param parentName
|
* @param viewsComponent
|
||||||
* @param analyticRelation 根据 name 从已注册路由分析父级路由
|
* @param routes
|
||||||
*/
|
* @param parentName
|
||||||
export const addRouteAll = (
|
* @param analyticRelation 根据 name 从已注册路由分析父级路由
|
||||||
viewsComponent: Record<string, any>,
|
*/
|
||||||
routes: any,
|
export const addRouteAll = (
|
||||||
parentName: string,
|
viewsComponent: Record<string, any>,
|
||||||
analyticRelation = false
|
routes: any,
|
||||||
) => {
|
parentName: string,
|
||||||
for (const idx in routes) {
|
analyticRelation = false
|
||||||
if (routes[idx].extend == 'add_menu_only') {
|
) => {
|
||||||
continue
|
for (const idx in routes) {
|
||||||
}
|
if (routes[idx].extend == 'add_menu_only') {
|
||||||
if (
|
continue
|
||||||
(routes[idx].menu_type == 'tab' && viewsComponent[routes[idx].component]) ||
|
}
|
||||||
routes[idx].menu_type == 'iframe'
|
if (
|
||||||
) {
|
(routes[idx].menu_type == 'tab' && viewsComponent[routes[idx].component]) ||
|
||||||
addRouteItem(viewsComponent, routes[idx], parentName, analyticRelation)
|
routes[idx].menu_type == 'iframe'
|
||||||
}
|
) {
|
||||||
|
addRouteItem(viewsComponent, routes[idx], parentName, analyticRelation)
|
||||||
if (routes[idx].children && routes[idx].children.length > 0) {
|
}
|
||||||
addRouteAll(viewsComponent, routes[idx].children, parentName, analyticRelation)
|
|
||||||
}
|
if (routes[idx].children && routes[idx].children.length > 0) {
|
||||||
}
|
addRouteAll(viewsComponent, routes[idx].children, parentName, analyticRelation)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
}
|
||||||
* 动态添加路由
|
|
||||||
* @param viewsComponent
|
/**
|
||||||
* @param route
|
* 动态添加路由
|
||||||
* @param parentName
|
* @param viewsComponent
|
||||||
* @param analyticRelation 根据 name 从已注册路由分析父级路由
|
* @param route
|
||||||
*/
|
* @param parentName
|
||||||
export const addRouteItem = (
|
* @param analyticRelation 根据 name 从已注册路由分析父级路由
|
||||||
viewsComponent: Record<string, any>,
|
*/
|
||||||
route: any,
|
export const addRouteItem = (
|
||||||
parentName: string,
|
viewsComponent: Record<string, any>,
|
||||||
analyticRelation: boolean
|
route: any,
|
||||||
) => {
|
parentName: string,
|
||||||
let path = '',
|
analyticRelation: boolean
|
||||||
component
|
) => {
|
||||||
if (route.menu_type == 'iframe') {
|
let path = '',
|
||||||
path = (isAdminApp() ? adminBaseRoute.path : '') + '/iframe/' + encodeURIComponent(route.url)
|
component
|
||||||
component = () => import('@/layouts/common/router-view/iframe.vue')
|
if (route.menu_type == 'iframe') {
|
||||||
} else {
|
path = (isAdminApp() ? adminBaseRoute.path : '') + '/iframe/' + encodeURIComponent(route.url)
|
||||||
path = parentName ? route.path : '/' + route.path
|
component = () => import('@/layouts/common/router-view/iframe.vue')
|
||||||
component = viewsComponent[route.component]
|
} else {
|
||||||
}
|
path = parentName ? route.path : '/' + route.path
|
||||||
|
component = viewsComponent[route.component]
|
||||||
if (route.menu_type == 'tab' && analyticRelation) {
|
}
|
||||||
const parentNames = getParentNames(route.name)
|
|
||||||
if (parentNames.length) {
|
if (route.menu_type == 'tab' && analyticRelation) {
|
||||||
for (const key in parentNames) {
|
const parentNames = getParentNames(route.name)
|
||||||
if (router.hasRoute(parentNames[key])) {
|
if (parentNames.length) {
|
||||||
parentName = parentNames[key]
|
for (const key in parentNames) {
|
||||||
break
|
if (router.hasRoute(parentNames[key])) {
|
||||||
}
|
parentName = parentNames[key]
|
||||||
}
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
const routeBaseInfo: RouteRecordRaw = {
|
}
|
||||||
path: path,
|
|
||||||
name: route.name,
|
const routeBaseInfo: RouteRecordRaw = {
|
||||||
component: component,
|
path: path,
|
||||||
meta: {
|
name: route.name,
|
||||||
...route,
|
component: component,
|
||||||
title: route.title,
|
meta: {
|
||||||
extend: route.extend,
|
...route,
|
||||||
icon: route.icon,
|
title: route.title,
|
||||||
keepalive: route.keepalive,
|
extend: route.extend,
|
||||||
menu_type: route.menu_type,
|
icon: route.icon,
|
||||||
type: route.type,
|
keepalive: route.keepalive,
|
||||||
url: route.url,
|
menu_type: route.menu_type,
|
||||||
addtab: true
|
type: route.type,
|
||||||
}
|
url: route.url,
|
||||||
}
|
addtab: true
|
||||||
if (parentName) {
|
}
|
||||||
router.addRoute(parentName, routeBaseInfo)
|
}
|
||||||
} else {
|
if (parentName) {
|
||||||
router.addRoute(routeBaseInfo)
|
router.addRoute(parentName, routeBaseInfo)
|
||||||
}
|
} else {
|
||||||
}
|
router.addRoute(routeBaseInfo)
|
||||||
|
}
|
||||||
/**
|
}
|
||||||
* 根据name字符串,获取父级name组合的数组
|
|
||||||
* @param name
|
/**
|
||||||
*/
|
* 根据name字符串,获取父级name组合的数组
|
||||||
const getParentNames = (name: string) => {
|
* @param name
|
||||||
const names = compact(name.split('/'))
|
*/
|
||||||
const tempNames = []
|
const getParentNames = (name: string) => {
|
||||||
const parentNames = []
|
const names = compact(name.split('/'))
|
||||||
for (const key in names) {
|
const tempNames = []
|
||||||
tempNames.push(names[key])
|
const parentNames = []
|
||||||
if (parseInt(key) != names.length - 1) {
|
for (const key in names) {
|
||||||
parentNames.push(tempNames.join('/'))
|
tempNames.push(names[key])
|
||||||
}
|
if (parseInt(key) != names.length - 1) {
|
||||||
}
|
parentNames.push(tempNames.join('/'))
|
||||||
return reverse(parentNames)
|
}
|
||||||
}
|
}
|
||||||
|
return reverse(parentNames)
|
||||||
|
}
|
||||||
|
// 刷新菜单
|
||||||
|
export const getMenu = () => {
|
||||||
|
getRouteMenu().then((res: any) => {
|
||||||
|
const handlerMenu = (data: any) => {
|
||||||
|
data.forEach((item: any) => {
|
||||||
|
item.routePath =
|
||||||
|
item.routePath[0] == '/' ? item.routePath.substring(1, item.routePath.length) : item.routePath
|
||||||
|
item.path = item.routePath
|
||||||
|
item.name = item.routePath
|
||||||
|
item.keepalive = item.routePath
|
||||||
|
item.component = item.routeName
|
||||||
|
? item.routeName.indexOf('/src/views/') > -1
|
||||||
|
? item.routeName
|
||||||
|
: `/src/views/${item.routeName}/index.vue`
|
||||||
|
: ''
|
||||||
|
item.type = item.children && item.children.length > 0 ? 'menu_dir' : 'menu'
|
||||||
|
item.menu_type = item.children && item.children.length > 0 ? null : 'tab'
|
||||||
|
if (item.children) {
|
||||||
|
handlerMenu(item.children)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
handlerMenu(res.data)
|
||||||
|
handleAdminRoute(res.data)
|
||||||
|
if (route?.params.to) {
|
||||||
|
const lastRoute = JSON.parse(route.params.to as string)
|
||||||
|
if (lastRoute.path != adminBaseRoutePath) {
|
||||||
|
let query = !isEmpty(lastRoute.query) ? lastRoute.query : {}
|
||||||
|
routePush({ path: lastRoute.path, query: query })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ export default class TableStore {
|
|||||||
* @param data 携带数据
|
* @param data 携带数据
|
||||||
*/
|
*/
|
||||||
onTableAction = (event: string, data: anyObj) => {
|
onTableAction = (event: string, data: anyObj) => {
|
||||||
|
|
||||||
const actionFun = new Map([
|
const actionFun = new Map([
|
||||||
[
|
[
|
||||||
'search',
|
'search',
|
||||||
@@ -202,6 +203,7 @@ export default class TableStore {
|
|||||||
'export',
|
'export',
|
||||||
() => {
|
() => {
|
||||||
// this.index()
|
// this.index()
|
||||||
|
console.log('export')
|
||||||
let params = { ...this.table.params, pageNum: 1, pageSize: this.table.total }
|
let params = { ...this.table.params, pageNum: 1, pageSize: this.table.total }
|
||||||
createAxios(
|
createAxios(
|
||||||
Object.assign(
|
Object.assign(
|
||||||
@@ -213,6 +215,7 @@ export default class TableStore {
|
|||||||
)
|
)
|
||||||
).then(res => {
|
).then(res => {
|
||||||
this.table.allData = filtration(res.data.records || res.data)
|
this.table.allData = filtration(res.data.records || res.data)
|
||||||
|
console.log('11111',this.table)
|
||||||
this.table.exportProcessingData && this.table.exportProcessingData()
|
this.table.exportProcessingData && this.table.exportProcessingData()
|
||||||
this.table.allFlag = data.showAllFlag || true
|
this.table.allFlag = data.showAllFlag || true
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const prop = defineProps({
|
|||||||
const dictData = useDictData()
|
const dictData = useDictData()
|
||||||
const fontdveoption = dictData.getBasicData('Dev_Ops')
|
const fontdveoption = dictData.getBasicData('Dev_Ops')
|
||||||
|
|
||||||
const tableStore = new TableStore({
|
const tableStore:any = new TableStore({
|
||||||
url: '/device-boot/pqsTerminalLogs/getList',
|
url: '/device-boot/pqsTerminalLogs/getList',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
column: [
|
column: [
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ const tableStore: any = new TableStore({
|
|||||||
{ field: 'describe', title: '事件描述' },
|
{ field: 'describe', title: '事件描述' },
|
||||||
{ field: 'type', title: '事件类型', sortable: true },
|
{ field: 'type', title: '事件类型', sortable: true },
|
||||||
{ field: 'result', title: '操作结果', sortable: true },
|
{ field: 'result', title: '操作结果', sortable: true },
|
||||||
{ field: 'ip', title: '操作IP' },
|
{ field: 'ip', title: '操作IP' ,width:'120px'},
|
||||||
{ field: 'level', title: '事件等级', sortable: true }
|
{ field: 'level', title: '事件等级', sortable: true }
|
||||||
],
|
],
|
||||||
loadCallback: () => {
|
loadCallback: () => {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const tableStore: any = new TableStore({
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
column: [
|
column: [
|
||||||
{ field: 'userName', title: '登录用户' },
|
{ field: 'userName', title: '登录用户' },
|
||||||
{ field: 'ip', title: '登录ip' },
|
{ field: 'ip', title: '登录ip' ,width:'120px'},
|
||||||
{ field: 'time', title: '登录时间' }
|
{ field: 'time', title: '登录时间' }
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<pane style="background: #fff">
|
<pane style="background: #fff">
|
||||||
<TableHeader :showSearch="false" v-show="props.rowList.id == undefined">
|
<TableHeader :showSearch="false" v-show="props.rowList.id == undefined">
|
||||||
<template #select>
|
<template #select>
|
||||||
<el-form-item label="时间">
|
<el-form-item label="统计时间">
|
||||||
<DatePicker ref="datePickerRef"></DatePicker>
|
<DatePicker ref="datePickerRef"></DatePicker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
@@ -205,7 +205,7 @@ const props = defineProps(['rowList'])
|
|||||||
const harmonic = harmonicOptions.filter(item => item.value < 26)
|
const harmonic = harmonicOptions.filter(item => item.value < 26)
|
||||||
const currentLod = ref(false)
|
const currentLod = ref(false)
|
||||||
const monitoringPoint = useMonitoringPoint()
|
const monitoringPoint = useMonitoringPoint()
|
||||||
const size = ref(0)
|
const size = ref(23)
|
||||||
const dictData = useDictData()
|
const dictData = useDictData()
|
||||||
const datePickerRef = ref()
|
const datePickerRef = ref()
|
||||||
const height = mainHeight(80).height
|
const height = mainHeight(80).height
|
||||||
|
|||||||
@@ -56,8 +56,10 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="区域" prop="regionList">
|
<el-form-item label="区域" prop="regionList">
|
||||||
<el-cascader v-model="form.regionList" style="width: 100%" :props="props" :options="areaList" />
|
<!-- <el-cascader v-model="form.regionList" style="width: 100%" :props="props" :options="areaList" /> -->
|
||||||
|
<el-cascader v-model="form.regionList" :props="props" :options="areaList" style="width: 100%" placeholder="请选择区域" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="详细地址:" prop="area">
|
<el-form-item label="详细地址:" prop="area">
|
||||||
<el-input
|
<el-input
|
||||||
clearable
|
clearable
|
||||||
@@ -93,6 +95,8 @@ import { mainHeight } from '@/utils/layout'
|
|||||||
import { useDictData } from '@/stores/dictData'
|
import { useDictData } from '@/stores/dictData'
|
||||||
import equipment from './equipment.vue'
|
import equipment from './equipment.vue'
|
||||||
import { addUse, updateUse, removeUse } from '@/api/advance-boot/bearingCapacity'
|
import { addUse, updateUse, removeUse } from '@/api/advance-boot/bearingCapacity'
|
||||||
|
import { getAreaDept } from '@/api/harmonic-boot/area'
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'estimate/photovoltaic'
|
name: 'estimate/photovoltaic'
|
||||||
})
|
})
|
||||||
@@ -104,7 +108,8 @@ const disabled = ref(false)
|
|||||||
const TableHeaderRef = ref()
|
const TableHeaderRef = ref()
|
||||||
const equipmentRef = ref()
|
const equipmentRef = ref()
|
||||||
const title = ref('')
|
const title = ref('')
|
||||||
const areaList: any = dictData.areaSelect()
|
//const areaList: any = dictData.areaSelect()
|
||||||
|
const areaList = ref([])
|
||||||
const userShow: any = ref('Power_Station_Users')
|
const userShow: any = ref('Power_Station_Users')
|
||||||
|
|
||||||
const form = ref({
|
const form = ref({
|
||||||
@@ -263,14 +268,20 @@ tableStore.table.params.userType = ''
|
|||||||
provide('tableStore', tableStore)
|
provide('tableStore', tableStore)
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
tableStore.index()
|
tableStore.index()
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
const useChange = (e: string) => {
|
const useChange = (e: string) => {
|
||||||
userShow.value = uesrList.filter(item => item.id == e)[0].code
|
userShow.value = uesrList.filter(item => item.id == e)[0].code
|
||||||
}
|
}
|
||||||
// 新增
|
// 新增
|
||||||
const add = () => {
|
const add = async () => {
|
||||||
disabled.value = false
|
disabled.value = false
|
||||||
title.value = '新增承载能力待评估用户'
|
title.value = '新增承载能力待评估用户'
|
||||||
|
|
||||||
|
await getAreaDept().then(res => {
|
||||||
|
areaList.value = JSON.parse(JSON.stringify(res.data))
|
||||||
|
})
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
// 保存
|
// 保存
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
|||||||
import { ElButton } from 'element-plus'
|
import { ElButton } from 'element-plus'
|
||||||
import { mainHeight } from '@/utils/layout'
|
import { mainHeight } from '@/utils/layout'
|
||||||
import Bind from './bind.vue'
|
import Bind from './bind.vue'
|
||||||
|
const VITE_FLAG = import.meta.env.VITE_NAME == 'hainan'
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'BusinessAdministrator/TerminalManagement/FrontManagement'
|
name: 'BusinessAdministrator/TerminalManagement/FrontManagement'
|
||||||
})
|
})
|
||||||
@@ -270,7 +271,7 @@ const tableStore = new TableStore({
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
column: [
|
column: [
|
||||||
{ title: '名称', field: 'name' },
|
{ title: '名称', field: 'name' },
|
||||||
{ title: 'IP', field: 'ip' },
|
{ title: 'IP', field: 'ip' ,width:'120px' },
|
||||||
{
|
{
|
||||||
title: '等级',
|
title: '等级',
|
||||||
field: 'nodeGrade',
|
field: 'nodeGrade',
|
||||||
@@ -338,6 +339,9 @@ const tableStore = new TableStore({
|
|||||||
type: 'warning',
|
type: 'warning',
|
||||||
icon: 'el-icon-Delete',
|
icon: 'el-icon-Delete',
|
||||||
render: 'confirmButton',
|
render: 'confirmButton',
|
||||||
|
disabled: row => {
|
||||||
|
return VITE_FLAG
|
||||||
|
},
|
||||||
popconfirm: {
|
popconfirm: {
|
||||||
confirmButtonText: '确认',
|
confirmButtonText: '确认',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
@@ -579,7 +583,7 @@ const addMenu = () => {}
|
|||||||
:deep(.default) {
|
:deep(.default) {
|
||||||
display: flex;
|
display: flex;
|
||||||
.row--current {
|
.row--current {
|
||||||
background-color: var(--el-color-primary-light-8) !important;
|
// background-color: var(--el-color-primary-light-8) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.custom-tree-node {
|
.custom-tree-node {
|
||||||
|
|||||||
@@ -1,355 +1,355 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="default-main" style="position: relative">
|
<div class="default-main" style="position: relative">
|
||||||
<TableHeader>
|
<TableHeader>
|
||||||
<template #select>
|
<template #select>
|
||||||
<el-form-item label="终端型号">
|
<el-form-item label="终端型号">
|
||||||
<el-select v-model="tableStore.table.params.teriminal" clearable placeholder="请选择终端型号">
|
<el-select v-model="tableStore.table.params.teriminal" clearable placeholder="请选择终端型号">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in teriminaloption"
|
v-for="item in teriminaloption"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="终端状态">
|
<el-form-item label="终端状态">
|
||||||
<el-select v-model="tableStore.table.params.teriminalstatus" clearable placeholder="请选择终端状态">
|
<el-select v-model="tableStore.table.params.teriminalstatus" clearable placeholder="请选择终端状态">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in teriminalstatusoption"
|
v-for="item in teriminalstatusoption"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="通讯状态">
|
<el-form-item label="通讯状态">
|
||||||
<el-select v-model="tableStore.table.params.state" clearable placeholder="请选择通讯状态">
|
<el-select v-model="tableStore.table.params.state" clearable placeholder="请选择通讯状态">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in stateoption"
|
v-for="item in stateoption"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="程序版本">
|
<el-form-item label="程序版本">
|
||||||
<el-select v-model="tableStore.table.params.program" clearable placeholder="请选择程序版本">
|
<el-select v-model="tableStore.table.params.program" clearable placeholder="请选择程序版本">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in programoption"
|
v-for="item in programoption"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="筛选">
|
<el-form-item label="筛选数据">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="tableStore.table.params.filterName"
|
v-model="tableStore.table.params.filterName"
|
||||||
@keyup="searchEvent"
|
@keyup="searchEvent"
|
||||||
placeholder="输入关键字筛选"
|
placeholder="输入关键字筛选"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template #operation>
|
<template #operation>
|
||||||
<el-button icon="el-icon-Download" @click="add">导出</el-button>
|
<el-button icon="el-icon-Download" @click="add">导出</el-button>
|
||||||
<el-button icon="el-icon-Check" @click="add">批量升级</el-button>
|
<el-button icon="el-icon-Check" @click="add">批量升级</el-button>
|
||||||
</template>
|
</template>
|
||||||
</TableHeader>
|
</TableHeader>
|
||||||
<div :style="`height: calc(${tableStore.table.height} + 58px)`">
|
<div :style="`height: calc(${tableStore.table.height} + 58px)`">
|
||||||
<vxe-table
|
<vxe-table
|
||||||
v-loading="tableStore.table.loading"
|
v-loading="tableStore.table.loading"
|
||||||
height="auto"
|
height="auto"
|
||||||
auto-resize
|
auto-resize
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
v-bind="defaultAttribute"
|
v-bind="defaultAttribute"
|
||||||
:data="treeData"
|
:data="treeData"
|
||||||
show-overflow
|
show-overflow
|
||||||
:tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }"
|
:tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }"
|
||||||
:scroll-y="{ enabled: true }"
|
:scroll-y="{ enabled: true }"
|
||||||
>
|
>
|
||||||
<vxe-column field="name" align="left" title="电网拓扑" min-width="200" tree-node></vxe-column>
|
<vxe-column field="name" align="left" title="电网拓扑" min-width="200" tree-node></vxe-column>
|
||||||
<vxe-column field="devType" title="终端型号" :formatter="formFilter"></vxe-column>
|
<vxe-column field="devType" title="终端型号" :formatter="formFilter"></vxe-column>
|
||||||
<vxe-column field="versionName" title="版本号"></vxe-column>
|
<vxe-column field="versionName" title="版本号"></vxe-column>
|
||||||
<vxe-column field="protocol" title="协议版本"></vxe-column>
|
<vxe-column field="protocol" title="协议版本"></vxe-column>
|
||||||
<vxe-column field="versionDate" title="版本日期"></vxe-column>
|
<vxe-column field="versionDate" title="版本日期"></vxe-column>
|
||||||
<vxe-column field="runFlag" title="终端状态">
|
<vxe-column field="runFlag" title="终端状态">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tag v-if="row.runFlag === 0" style="color: #fff; background: #0099cc" size="small">
|
<el-tag v-if="row.runFlag === 0" style="color: #fff; background: #0099cc" size="small">
|
||||||
投运
|
投运
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag v-if="row.runFlag === 1" style="color: #fff; background: #996600" size="small">
|
<el-tag v-if="row.runFlag === 1" style="color: #fff; background: #996600" size="small">
|
||||||
检修
|
检修
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag v-if="row.runFlag === 2" style="color: #fff; background: #A52a2a" size="small">
|
<el-tag v-if="row.runFlag === 2" style="color: #fff; background: #A52a2a" size="small">
|
||||||
停运
|
停运
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
<vxe-column field="comFlag" title="通讯状态">
|
<vxe-column field="comFlag" title="通讯状态">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tag v-if="row.comFlag === 0" style="color: #fff; background: #A52a2a" size="small">
|
<el-tag v-if="row.comFlag === 0" style="color: #fff; background: #A52a2a" size="small">
|
||||||
中断
|
中断
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag v-if="row.comFlag === 1" style="color: #fff; background: #2e8b57" size="small">
|
<el-tag v-if="row.comFlag === 1" style="color: #fff; background: #2e8b57" size="small">
|
||||||
正常
|
正常
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
<vxe-column field="updateBy" title="升级人员">
|
<vxe-column field="updateBy" title="升级人员">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<span v-if="row.updateBy == null || row.updateBy == '/'">--</span>
|
<span v-if="row.updateBy == null || row.updateBy == '/'">--</span>
|
||||||
<span v-else>{{ row.updateBy }}</span>
|
<span v-else>{{ row.updateBy }}</span>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
<vxe-column field="updateTime" title="最新升级时间"></vxe-column>
|
<vxe-column field="updateTime" title="最新升级时间"></vxe-column>
|
||||||
<vxe-column title="操作" min-width="100">
|
<vxe-column title="操作" min-width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button v-if="row.level == 4" size="small" link @click="updateprogram(row)">升级</el-button>
|
<el-button v-if="row.level == 4" size="small" link @click="updateprogram(row)">升级</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="row.level == 4"
|
v-if="row.level == 4"
|
||||||
:disabled="row.state == 1 ? true : false"
|
:disabled="row.state == 1 ? true : false"
|
||||||
size="small"
|
size="small"
|
||||||
link
|
link
|
||||||
@click="queryview(row)"
|
@click="queryview(row)"
|
||||||
>
|
>
|
||||||
日志查看
|
日志查看
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
</vxe-table>
|
</vxe-table>
|
||||||
</div>
|
</div>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
draggable
|
draggable
|
||||||
v-model="dialogVisible"
|
v-model="dialogVisible"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
:title="protitle + '#终端升级日志查看'"
|
:title="protitle + '#终端升级日志查看'"
|
||||||
width="70%"
|
width="70%"
|
||||||
>
|
>
|
||||||
<div :style="{ height: dialogHeight.height }">
|
<div :style="{ height: dialogHeight.height }">
|
||||||
<vxe-table height="auto" auto-resize :data="logtableData" v-bind="defaultAttribute">
|
<vxe-table height="auto" auto-resize :data="logtableData" v-bind="defaultAttribute">
|
||||||
<vxe-column field="devTypeName" align="center" title="终端序号"></vxe-column>
|
<vxe-column field="devTypeName" align="center" title="终端序号"></vxe-column>
|
||||||
<vxe-column field="versionId" align="center" title="版本序号"></vxe-column>
|
<vxe-column field="versionId" align="center" title="版本序号"></vxe-column>
|
||||||
<vxe-column field="flag" align="center" title="版本状态" width="100">
|
<vxe-column field="flag" align="center" title="版本状态" width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tag v-if="row.flag == true" style="color: #fff; background: #fc0">前期版本</el-tag>
|
<el-tag v-if="row.flag == true" style="color: #fff; background: #fc0">前期版本</el-tag>
|
||||||
<el-tag v-if="row.flag == false" style="color: #fff; background: #0c0">当前版本</el-tag>
|
<el-tag v-if="row.flag == false" style="color: #fff; background: #0c0">当前版本</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
<vxe-column field="result" align="center" title="升级结果" width="100">
|
<vxe-column field="result" align="center" title="升级结果" width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tag v-if="row.result == false" style="color: #fff; background: #f30">升级失败</el-tag>
|
<el-tag v-if="row.result == false" style="color: #fff; background: #f30">升级失败</el-tag>
|
||||||
<el-tag v-if="row.result == true" style="color: #fff; background: #093">升级成功</el-tag>
|
<el-tag v-if="row.result == true" style="color: #fff; background: #093">升级成功</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
<vxe-column field="state" align="center" title="状态" width="100">
|
<vxe-column field="state" align="center" title="状态" width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tag v-if="row.state == false" style="color: #fff; background: #f30">删除</el-tag>
|
<el-tag v-if="row.state == false" style="color: #fff; background: #f30">删除</el-tag>
|
||||||
<el-tag v-if="row.state == true" style="color: #fff; background: #093">正常</el-tag>
|
<el-tag v-if="row.state == true" style="color: #fff; background: #093">正常</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
<vxe-column field="createBy" align="center" title="创建用户"></vxe-column>
|
<vxe-column field="createBy" align="center" title="创建用户"></vxe-column>
|
||||||
<vxe-column field="createTime" align="center" title="创建时间"></vxe-column>
|
<vxe-column field="createTime" align="center" title="创建时间"></vxe-column>
|
||||||
<vxe-column field="updateTime" align="center" title="升级时间"></vxe-column>
|
<vxe-column field="updateTime" align="center" title="升级时间"></vxe-column>
|
||||||
<vxe-column field="updateBy" align="center" title="升级人员"></vxe-column>
|
<vxe-column field="updateBy" align="center" title="升级人员"></vxe-column>
|
||||||
</vxe-table>
|
</vxe-table>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<!-- 升级 -->
|
<!-- 升级 -->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
draggable
|
draggable
|
||||||
v-model="prodialogVisible"
|
v-model="prodialogVisible"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
:title="protitle + '#终端程序升级'"
|
:title="protitle + '#终端程序升级'"
|
||||||
width="40%"
|
width="40%"
|
||||||
>
|
>
|
||||||
<el-col v-for="(item, index) in percentageoption" :key="index">
|
<el-col v-for="(item, index) in percentageoption" :key="index">
|
||||||
<span style="font-size: 14px; font-weight: bold">{{ item.name }}</span>
|
<span style="font-size: 14px; font-weight: bold">{{ item.name }}</span>
|
||||||
:
|
:
|
||||||
<el-progress
|
<el-progress
|
||||||
:text-inside="true"
|
:text-inside="true"
|
||||||
:stroke-width="24"
|
:stroke-width="24"
|
||||||
:percentage="item.percentage"
|
:percentage="item.percentage"
|
||||||
:status="item.status"
|
:status="item.status"
|
||||||
:format="format"
|
:format="format"
|
||||||
></el-progress>
|
></el-progress>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, provide, nextTick } from 'vue'
|
import { ref, onMounted, provide, nextTick } from 'vue'
|
||||||
import TableStore from '@/utils/tableStore'
|
import TableStore from '@/utils/tableStore'
|
||||||
import { defaultAttribute } from '@/components/table/defaultAttribute'
|
import { defaultAttribute } from '@/components/table/defaultAttribute'
|
||||||
import TableHeader from '@/components/table/header/index.vue'
|
import TableHeader from '@/components/table/header/index.vue'
|
||||||
import { mainHeight } from '@/utils/layout'
|
import { mainHeight } from '@/utils/layout'
|
||||||
import { getTerminalUpLog } from '@/api/device-boot/Business'
|
import { getTerminalUpLog } from '@/api/device-boot/Business'
|
||||||
import XEUtils from 'xe-utils'
|
import XEUtils from 'xe-utils'
|
||||||
import { getDevTypeList } from '@/api/device-boot/modelManage'
|
import { getDevTypeList } from '@/api/device-boot/modelManage'
|
||||||
import { debounce } from 'lodash-es'
|
import { debounce } from 'lodash-es'
|
||||||
import { useDictData } from '@/stores/dictData'
|
import { useDictData } from '@/stores/dictData'
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'BusinessAdministrator/TerminalManagement/ProgramManagement'
|
name: 'BusinessAdministrator/TerminalManagement/ProgramManagement'
|
||||||
})
|
})
|
||||||
|
|
||||||
const pageHeight = mainHeight(83)
|
const pageHeight = mainHeight(83)
|
||||||
const dialogHeight = mainHeight(300)
|
const dialogHeight = mainHeight(300)
|
||||||
const dictData = useDictData()
|
const dictData = useDictData()
|
||||||
const teriminaloption: any = ref([])
|
const teriminaloption: any = ref([])
|
||||||
const teriminalstatusoption = ref([
|
const teriminalstatusoption = ref([
|
||||||
{ name: '全部', id: '' },
|
{ name: '全部', id: '' },
|
||||||
{ name: '投运', id: 0 },
|
{ name: '投运', id: 0 },
|
||||||
{ name: '检修', id: 1 },
|
{ name: '检修', id: 1 },
|
||||||
{ name: '停运', id: 2 }
|
{ name: '停运', id: 2 }
|
||||||
])
|
])
|
||||||
const stateoption = ref([
|
const stateoption = ref([
|
||||||
{ name: '全部', id: '' },
|
{ name: '全部', id: '' },
|
||||||
{ name: '正常', id: 1 },
|
{ name: '正常', id: 1 },
|
||||||
{ name: '中断', id: 0 }
|
{ name: '中断', id: 0 }
|
||||||
])
|
])
|
||||||
const prodialogVisible = ref(false)
|
const prodialogVisible = ref(false)
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const protitle = ref('')
|
const protitle = ref('')
|
||||||
const treeData: any = ref([])
|
const treeData: any = ref([])
|
||||||
const treeDataCopy: any = ref([])
|
const treeDataCopy: any = ref([])
|
||||||
//进度条对象
|
//进度条对象
|
||||||
const percentageoption = ref([
|
const percentageoption = ref([
|
||||||
{
|
{
|
||||||
name: '1号测试终端',
|
name: '1号测试终端',
|
||||||
status: 'exception',
|
status: 'exception',
|
||||||
percentage: 20
|
percentage: 20
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '2号测试终端',
|
name: '2号测试终端',
|
||||||
status: 'warning',
|
status: 'warning',
|
||||||
percentage: 50
|
percentage: 50
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '3号测试终端',
|
name: '3号测试终端',
|
||||||
status: 'success',
|
status: 'success',
|
||||||
percentage: 90
|
percentage: 90
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
const programoption: any = ref([])
|
const programoption: any = ref([])
|
||||||
const logtableData: any = ref([])
|
const logtableData: any = ref([])
|
||||||
const tableRef = ref()
|
const tableRef = ref()
|
||||||
const status = ref('')
|
const status = ref('')
|
||||||
const tableStore = new TableStore({
|
const tableStore = new TableStore({
|
||||||
url: '/device-boot/version/getTerminalVersionList',
|
url: '/device-boot/version/getTerminalVersionList',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
column: [],
|
column: [],
|
||||||
loadCallback: () => {
|
loadCallback: () => {
|
||||||
// tableStore.table.data.forEach((item: any) => {
|
// tableStore.table.data.forEach((item: any) => {
|
||||||
// if (item.children.length > 0) {
|
// if (item.children.length > 0) {
|
||||||
// item.id = item.children[0].pid
|
// item.id = item.children[0].pid
|
||||||
// }
|
// }
|
||||||
// })
|
// })
|
||||||
treeData.value = tree2List(tableStore.table.data, Math.random() * 1000)
|
treeData.value = tree2List(tableStore.table.data, Math.random() * 1000)
|
||||||
treeDataCopy.value = JSON.parse(JSON.stringify(treeData.value))
|
treeDataCopy.value = JSON.parse(JSON.stringify(treeData.value))
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
tableRef.value.setAllTreeExpand(true)
|
tableRef.value.setAllTreeExpand(true)
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
tableStore.table.params.teriminal = ''
|
tableStore.table.params.teriminal = ''
|
||||||
tableStore.table.params.state = ''
|
tableStore.table.params.state = ''
|
||||||
tableStore.table.params.program = ''
|
tableStore.table.params.program = ''
|
||||||
tableStore.table.params.searchEvent = ''
|
tableStore.table.params.searchEvent = ''
|
||||||
tableStore.table.params.filterName = ''
|
tableStore.table.params.filterName = ''
|
||||||
provide('tableStore', tableStore)
|
provide('tableStore', tableStore)
|
||||||
|
|
||||||
const tree2List = (list: any, id: any) => {
|
const tree2List = (list: any, id: any) => {
|
||||||
//存储结果的数组
|
//存储结果的数组
|
||||||
let arr: any = []
|
let arr: any = []
|
||||||
// 遍历 tree 数组
|
// 遍历 tree 数组
|
||||||
list.forEach((item: any) => {
|
list.forEach((item: any) => {
|
||||||
item.uPid = id
|
item.uPid = id
|
||||||
item.uId = Math.random() * 1000
|
item.uId = Math.random() * 1000
|
||||||
|
|
||||||
// 判断item是否存在children
|
// 判断item是否存在children
|
||||||
if (!item.children) return arr.push(item)
|
if (!item.children) return arr.push(item)
|
||||||
// 函数递归,对children数组进行tree2List的转换
|
// 函数递归,对children数组进行tree2List的转换
|
||||||
const children = tree2List(item.children, item.uId)
|
const children = tree2List(item.children, item.uId)
|
||||||
// 删除item的children属性
|
// 删除item的children属性
|
||||||
delete item.children
|
delete item.children
|
||||||
// 把item和children数组添加至结果数组
|
// 把item和children数组添加至结果数组
|
||||||
//..children: 意思是把children数组展开
|
//..children: 意思是把children数组展开
|
||||||
arr.push(item, ...children)
|
arr.push(item, ...children)
|
||||||
})
|
})
|
||||||
// 返回结果数组
|
// 返回结果数组
|
||||||
return arr
|
return arr
|
||||||
}
|
}
|
||||||
|
|
||||||
tableStore.table.params.searchValue = ''
|
tableStore.table.params.searchValue = ''
|
||||||
tableStore.table.params.searchState = 0
|
tableStore.table.params.searchState = 0
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getDevTypeList().then(res => {
|
getDevTypeList().then(res => {
|
||||||
teriminaloption.value = res.data
|
teriminaloption.value = res.data
|
||||||
})
|
})
|
||||||
tableStore.index()
|
tableStore.index()
|
||||||
})
|
})
|
||||||
const add = () => {}
|
const add = () => {}
|
||||||
const updateprogram = (row: any) => {
|
const updateprogram = (row: any) => {
|
||||||
protitle.value = row.name
|
protitle.value = row.name
|
||||||
prodialogVisible.value = true
|
prodialogVisible.value = true
|
||||||
}
|
}
|
||||||
const queryview = (row: any) => {
|
const queryview = (row: any) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
protitle.value = row.name
|
protitle.value = row.name
|
||||||
let data = {
|
let data = {
|
||||||
id: row.id
|
id: row.id
|
||||||
}
|
}
|
||||||
getTerminalUpLog(data).then((res: any) => {
|
getTerminalUpLog(data).then((res: any) => {
|
||||||
logtableData.value = res.data
|
logtableData.value = res.data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const format = (percentage: any) => {
|
const format = (percentage: any) => {
|
||||||
if (percentage <= 100 && percentage >= 90) {
|
if (percentage <= 100 && percentage >= 90) {
|
||||||
status.value = 'success'
|
status.value = 'success'
|
||||||
return percentage === 100 ? '升级成功' : `${percentage}%`
|
return percentage === 100 ? '升级成功' : `${percentage}%`
|
||||||
} else if (percentage > 0 && percentage < 50) {
|
} else if (percentage > 0 && percentage < 50) {
|
||||||
status.value = 'exception'
|
status.value = 'exception'
|
||||||
return percentage <= 20 ? '升级失败' + percentage + '%' : `${percentage}%`
|
return percentage <= 20 ? '升级失败' + percentage + '%' : `${percentage}%`
|
||||||
} else if (percentage > 0 && percentage <= 50) {
|
} else if (percentage > 0 && percentage <= 50) {
|
||||||
status.value = 'warning'
|
status.value = 'warning'
|
||||||
return percentage <= 50 ? '升级中断' : `${percentage}%`
|
return percentage <= 50 ? '升级中断' : `${percentage}%`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const formFilter = (row: any) => {
|
const formFilter = (row: any) => {
|
||||||
let title = '/'
|
let title = '/'
|
||||||
if (row.cellValue != null) {
|
if (row.cellValue != null) {
|
||||||
teriminaloption.value.forEach((item: any) => {
|
teriminaloption.value.forEach((item: any) => {
|
||||||
if (item.id == row.cellValue) {
|
if (item.id == row.cellValue) {
|
||||||
title = item.name
|
title = item.name
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return title
|
return title
|
||||||
}
|
}
|
||||||
|
|
||||||
// 表格过滤
|
// 表格过滤
|
||||||
const searchEvent = debounce(e => {
|
const searchEvent = debounce(e => {
|
||||||
const filterVal = XEUtils.toValueString(tableStore.table.params.filterName).trim().toLowerCase()
|
const filterVal = XEUtils.toValueString(tableStore.table.params.filterName).trim().toLowerCase()
|
||||||
if (filterVal) {
|
if (filterVal) {
|
||||||
const options = { children: 'children' }
|
const options = { children: 'children' }
|
||||||
const searchProps = ['name']
|
const searchProps = ['name']
|
||||||
const rest = XEUtils.searchTree(
|
const rest = XEUtils.searchTree(
|
||||||
treeDataCopy,
|
treeDataCopy,
|
||||||
(item: any) => searchProps.some(key => String(item[key]).toLowerCase().indexOf(filterVal) > -1),
|
(item: any) => searchProps.some(key => String(item[key]).toLowerCase().indexOf(filterVal) > -1),
|
||||||
options
|
options
|
||||||
)
|
)
|
||||||
|
|
||||||
treeData.value = rest
|
treeData.value = rest
|
||||||
|
|
||||||
// 搜索之后默认展开所有子节点
|
// 搜索之后默认展开所有子节点
|
||||||
} else {
|
} else {
|
||||||
treeData.value = treeDataCopy
|
treeData.value = treeDataCopy
|
||||||
}
|
}
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const $table = tableRef.value
|
const $table = tableRef.value
|
||||||
if ($table) {
|
if ($table) {
|
||||||
$table.setAllTreeExpand(true)
|
$table.setAllTreeExpand(true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, 300)
|
}, 300)
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
:checkbox-config="{ labelField: 'name' }"
|
:checkbox-config="{ labelField: 'name' }"
|
||||||
>
|
>
|
||||||
<vxe-column field="name" align="left" title="电网拓扑" min-width="200" tree-node></vxe-column>
|
<vxe-column field="name" align="left" title="电网拓扑" min-width="200" tree-node></vxe-column>
|
||||||
<vxe-column field="ip" title="网络参数"></vxe-column>
|
<vxe-column field="ip" title="网络参数" width="120px"></vxe-column>
|
||||||
<vxe-column field="runFlag" title="终端状态" v-if="key == 0">
|
<vxe-column field="runFlag" title="终端状态" v-if="key == 0">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tag v-if="row.runFlag === 0" type="success" size="small">投运</el-tag>
|
<el-tag v-if="row.runFlag === 0" type="success" size="small">投运</el-tag>
|
||||||
|
|||||||
@@ -1,282 +1,282 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="default-main" style="position: relative">
|
<div class="default-main" style="position: relative">
|
||||||
<TableHeader>
|
<TableHeader>
|
||||||
<template #select>
|
<template #select>
|
||||||
<el-form-item label="终端型号">
|
<el-form-item label="终端型号">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="tableStore.table.params.devType"
|
v-model="tableStore.table.params.devType"
|
||||||
filterable
|
filterable
|
||||||
clearable
|
clearable
|
||||||
placeholder="请选择终端型号"
|
placeholder="请选择终端型号"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in teriminaloption"
|
v-for="item in teriminaloption"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="终端状态">
|
<el-form-item label="终端状态">
|
||||||
<el-select v-model="tableStore.table.params.runFlag" clearable placeholder="请选择终端状态">
|
<el-select v-model="tableStore.table.params.runFlag" clearable placeholder="请选择终端状态">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in teriminalstatusoption"
|
v-for="item in teriminalstatusoption"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="通讯状态">
|
<el-form-item label="通讯状态">
|
||||||
<el-select v-model="tableStore.table.params.comFlag" clearable placeholder="请选择通讯状态">
|
<el-select v-model="tableStore.table.params.comFlag" clearable placeholder="请选择通讯状态">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in stateoption"
|
v-for="item in stateoption"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="筛选">
|
<el-form-item label="筛选数据">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="tableStore.table.params.filterName"
|
v-model="tableStore.table.params.filterName"
|
||||||
@keyup="searchEvent"
|
@keyup="searchEvent"
|
||||||
clearable
|
clearable
|
||||||
placeholder="输入关键字筛选"
|
placeholder="输入关键字筛选"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template #operation>
|
<template #operation>
|
||||||
<el-button type="primary" icon="el-icon-DataLine" @click="manage('终端状态管理', 0)">
|
<el-button type="primary" icon="el-icon-DataLine" @click="manage('终端状态管理', 0)">
|
||||||
终端状态管理
|
终端状态管理
|
||||||
</el-button>
|
</el-button>
|
||||||
<!-- <el-button type="primary" icon="el-icon-Operation" @click="manage('流量套餐配置', 1)">
|
<!-- <el-button type="primary" icon="el-icon-Operation" @click="manage('流量套餐配置', 1)">
|
||||||
流量套餐配置
|
流量套餐配置
|
||||||
</el-button> -->
|
</el-button> -->
|
||||||
<!-- <el-button type="primary" icon="el-icon-Menu" @click="manage('流量策略配置', 2)">
|
<!-- <el-button type="primary" icon="el-icon-Menu" @click="manage('流量策略配置', 2)">
|
||||||
流量策略配置
|
流量策略配置
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="primary" icon="el-icon-Histogram" @click="liultjData">流量统计</el-button> -->
|
<el-button type="primary" icon="el-icon-Histogram" @click="liultjData">流量统计</el-button> -->
|
||||||
<!-- <el-button type="primary" icon="el-icon-Setting" @click="resect">重启前置程序</el-button> -->
|
<!-- <el-button type="primary" icon="el-icon-Setting" @click="resect">重启前置程序</el-button> -->
|
||||||
</template>
|
</template>
|
||||||
</TableHeader>
|
</TableHeader>
|
||||||
<div :style="`height: calc(${tableStore.table.height} + 58px)`">
|
<div :style="`height: calc(${tableStore.table.height} + 58px)`">
|
||||||
<vxe-table
|
<vxe-table
|
||||||
v-loading="tableStore.table.loading"
|
v-loading="tableStore.table.loading"
|
||||||
height="auto"
|
height="auto"
|
||||||
auto-resize
|
auto-resize
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
v-bind="defaultAttribute"
|
v-bind="defaultAttribute"
|
||||||
:data="treeData"
|
:data="treeData"
|
||||||
show-overflow
|
show-overflow
|
||||||
:tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }"
|
:tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }"
|
||||||
:scroll-y="{ enabled: true }"
|
:scroll-y="{ enabled: true }"
|
||||||
:checkbox-config="{ labelField: 'name' }"
|
:checkbox-config="{ labelField: 'name' }"
|
||||||
>
|
>
|
||||||
<vxe-column
|
<vxe-column
|
||||||
field="name"
|
field="name"
|
||||||
align="left"
|
align="left"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
title="电网拓扑"
|
title="电网拓扑"
|
||||||
min-width="200"
|
min-width="200"
|
||||||
tree-node
|
tree-node
|
||||||
></vxe-column>
|
></vxe-column>
|
||||||
<vxe-column field="devType" title="终端型号">
|
<vxe-column field="devType" title="终端型号">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ teriminaloption.find((item: any) => item.id === row.devType)?.name }}
|
{{ teriminaloption.find((item: any) => item.id === row.devType)?.name }}
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
<vxe-column field="version" title="版本信息"></vxe-column>
|
<vxe-column field="version" title="版本信息"></vxe-column>
|
||||||
<vxe-column field="ip" title="网络参数"></vxe-column>
|
<vxe-column field="ip" title="网络参数" width="120px"></vxe-column>
|
||||||
|
|
||||||
<vxe-column field="runFlag" title="终端状态">
|
<vxe-column field="runFlag" title="终端状态">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tag v-if="row.runFlag === 0" type="success" :disable-transitions="true" size="small">投运</el-tag>
|
<el-tag v-if="row.runFlag === 0" type="success" :disable-transitions="true" size="small">投运</el-tag>
|
||||||
<el-tag v-if="row.runFlag === 1" type="warning" :disable-transitions="true" size="small">检修</el-tag>
|
<el-tag v-if="row.runFlag === 1" type="warning" :disable-transitions="true" size="small">检修</el-tag>
|
||||||
<el-tag v-if="row.runFlag === 2" type="danger" :disable-transitions="true" size="small">停运</el-tag>
|
<el-tag v-if="row.runFlag === 2" type="danger" :disable-transitions="true" size="small">停运</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
<vxe-column field="comFlag" title="通讯状态">
|
<vxe-column field="comFlag" title="通讯状态">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tag v-if="row.comFlag === 0" type="danger" :disable-transitions="true" size="small">中断</el-tag>
|
<el-tag v-if="row.comFlag === 0" type="danger" :disable-transitions="true" size="small">中断</el-tag>
|
||||||
<el-tag v-if="row.comFlag === 1" type="success" :disable-transitions="true" size="small">正常</el-tag>
|
<el-tag v-if="row.comFlag === 1" type="success" :disable-transitions="true" size="small">正常</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
<vxe-column title="操作" width="160">
|
<vxe-column title="操作" width="160">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<!-- <el-button v-if="row.level === 4" type="primary" size="small" link @click="uesdealia(row)">
|
<!-- <el-button v-if="row.level === 4" type="primary" size="small" link @click="uesdealia(row)">
|
||||||
终端详情
|
终端详情
|
||||||
</el-button> -->
|
</el-button> -->
|
||||||
<el-button v-if="row.level === 4" type="primary" size="small" link @click="log(row)">
|
<el-button v-if="row.level === 4" type="primary" size="small" link @click="log(row)">
|
||||||
查看日志
|
查看日志
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
</vxe-table>
|
</vxe-table>
|
||||||
</div>
|
</div>
|
||||||
<!-- 终端详情 -->
|
<!-- 终端详情 -->
|
||||||
<detail ref="detailRef" />
|
<detail ref="detailRef" />
|
||||||
<!-- 配置 -->
|
<!-- 配置 -->
|
||||||
<disposition ref="dispositionRef" @onSubmit="tableStore.index()" />
|
<disposition ref="dispositionRef" @onSubmit="tableStore.index()" />
|
||||||
<!-- 日志 -->
|
<!-- 日志 -->
|
||||||
<Log ref="logRef" v-if="logFlag" @close="logFlag = false" />
|
<Log ref="logRef" v-if="logFlag" @close="logFlag = false" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, provide, nextTick, reactive } from 'vue'
|
import { ref, onMounted, provide, nextTick, reactive } from 'vue'
|
||||||
import TableStore from '@/utils/tableStore'
|
import TableStore from '@/utils/tableStore'
|
||||||
import { defaultAttribute } from '@/components/table/defaultAttribute'
|
import { defaultAttribute } from '@/components/table/defaultAttribute'
|
||||||
import TableHeader from '@/components/table/header/index.vue'
|
import TableHeader from '@/components/table/header/index.vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { getDevTypeList } from '@/api/device-boot/modelManage'
|
import { getDevTypeList } from '@/api/device-boot/modelManage'
|
||||||
import XEUtils from 'xe-utils'
|
import XEUtils from 'xe-utils'
|
||||||
import { debounce } from 'lodash-es'
|
import { debounce } from 'lodash-es'
|
||||||
|
|
||||||
import disposition from './components/disposition.vue'
|
import disposition from './components/disposition.vue'
|
||||||
import detail from './components/detail.vue'
|
import detail from './components/detail.vue'
|
||||||
import Log from './components/log.vue'
|
import Log from './components/log.vue'
|
||||||
import { useDictData } from '@/stores/dictData'
|
import { useDictData } from '@/stores/dictData'
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'BusinessAdministrator/TerminalManagement/TerminalManagement'
|
name: 'BusinessAdministrator/TerminalManagement/TerminalManagement'
|
||||||
})
|
})
|
||||||
const dispositionRef = ref()
|
const dispositionRef = ref()
|
||||||
const detailRef = ref()
|
const detailRef = ref()
|
||||||
const logRef = ref()
|
const logRef = ref()
|
||||||
const dictData = useDictData()
|
const dictData = useDictData()
|
||||||
const logFlag = ref(false)
|
const logFlag = ref(false)
|
||||||
const teriminaloption: any = ref([])
|
const teriminaloption: any = ref([])
|
||||||
|
|
||||||
const teriminalstatusoption = ref([
|
const teriminalstatusoption = ref([
|
||||||
{ name: '全部', id: '' },
|
{ name: '全部', id: '' },
|
||||||
{ name: '投运', id: 0 },
|
{ name: '投运', id: 0 },
|
||||||
{ name: '检修', id: 1 },
|
{ name: '检修', id: 1 },
|
||||||
{ name: '停运', id: 2 }
|
{ name: '停运', id: 2 }
|
||||||
])
|
])
|
||||||
const stateoption = ref([
|
const stateoption = ref([
|
||||||
{ name: '全部', id: '' },
|
{ name: '全部', id: '' },
|
||||||
{ name: '正常', id: 1 },
|
{ name: '正常', id: 1 },
|
||||||
{ name: '中断', id: 0 }
|
{ name: '中断', id: 0 }
|
||||||
])
|
])
|
||||||
const treeData: any = ref([])
|
const treeData: any = ref([])
|
||||||
const treeDataCopy: any = ref([])
|
const treeDataCopy: any = ref([])
|
||||||
|
|
||||||
const tableRef = ref()
|
const tableRef = ref()
|
||||||
|
|
||||||
const tableStore = new TableStore({
|
const tableStore = new TableStore({
|
||||||
url: '/device-boot/maintain/getTerminalMainList',
|
url: '/device-boot/maintain/getTerminalMainList',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
column: [],
|
column: [],
|
||||||
loadCallback: () => {
|
loadCallback: () => {
|
||||||
treeData.value = tree2List(tableStore.table.data, Math.random() * 1000)
|
treeData.value = tree2List(tableStore.table.data, Math.random() * 1000)
|
||||||
treeDataCopy.value = JSON.parse(JSON.stringify(treeData.value))
|
treeDataCopy.value = JSON.parse(JSON.stringify(treeData.value))
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
tableRef.value.setAllTreeExpand(true)
|
tableRef.value.setAllTreeExpand(true)
|
||||||
}, 0)
|
}, 0)
|
||||||
searchEvent()
|
searchEvent()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
tableStore.table.params.devType = ''
|
tableStore.table.params.devType = ''
|
||||||
tableStore.table.params.runFlag = ''
|
tableStore.table.params.runFlag = ''
|
||||||
tableStore.table.params.comFlag = ''
|
tableStore.table.params.comFlag = ''
|
||||||
tableStore.table.params.filterName = ''
|
tableStore.table.params.filterName = ''
|
||||||
// 处理大数据卡顿
|
// 处理大数据卡顿
|
||||||
const tree2List = (list: any, id: any) => {
|
const tree2List = (list: any, id: any) => {
|
||||||
//存储结果的数组
|
//存储结果的数组
|
||||||
let arr: any = []
|
let arr: any = []
|
||||||
// 遍历 tree 数组
|
// 遍历 tree 数组
|
||||||
list.forEach((item: any) => {
|
list.forEach((item: any) => {
|
||||||
item.uPid = id
|
item.uPid = id
|
||||||
item.uId = Math.random() * 1000
|
item.uId = Math.random() * 1000
|
||||||
|
|
||||||
// 判断item是否存在children
|
// 判断item是否存在children
|
||||||
if (!item.children) return arr.push(item)
|
if (!item.children) return arr.push(item)
|
||||||
// 函数递归,对children数组进行tree2List的转换
|
// 函数递归,对children数组进行tree2List的转换
|
||||||
const children = tree2List(item.children, item.uId)
|
const children = tree2List(item.children, item.uId)
|
||||||
// 删除item的children属性
|
// 删除item的children属性
|
||||||
delete item.children
|
delete item.children
|
||||||
// 把item和children数组添加至结果数组
|
// 把item和children数组添加至结果数组
|
||||||
//..children: 意思是把children数组展开
|
//..children: 意思是把children数组展开
|
||||||
arr.push(item, ...children)
|
arr.push(item, ...children)
|
||||||
})
|
})
|
||||||
// 返回结果数组
|
// 返回结果数组
|
||||||
return arr
|
return arr
|
||||||
}
|
}
|
||||||
|
|
||||||
provide('tableStore', tableStore)
|
provide('tableStore', tableStore)
|
||||||
tableStore.table.params.searchValue = ''
|
tableStore.table.params.searchValue = ''
|
||||||
tableStore.table.params.searchState = 0
|
tableStore.table.params.searchState = 0
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getDevTypeList().then(res => {
|
getDevTypeList().then(res => {
|
||||||
teriminaloption.value = res.data
|
teriminaloption.value = res.data
|
||||||
})
|
})
|
||||||
|
|
||||||
tableStore.index()
|
tableStore.index()
|
||||||
})
|
})
|
||||||
|
|
||||||
// 终端状态管理
|
// 终端状态管理
|
||||||
const manage = (name: string, key: number) => {
|
const manage = (name: string, key: number) => {
|
||||||
const $table = tableRef.value
|
const $table = tableRef.value
|
||||||
if ($table) {
|
if ($table) {
|
||||||
const selectRecords = $table
|
const selectRecords = $table
|
||||||
.getCheckboxRecords()
|
.getCheckboxRecords()
|
||||||
.filter((item: any) => item.level == 4)
|
.filter((item: any) => item.level == 4)
|
||||||
.map(item => item.id)
|
.map(item => item.id)
|
||||||
console.log('🚀 ~ deviceData ~ selectRecords:', selectRecords)
|
console.log('🚀 ~ deviceData ~ selectRecords:', selectRecords)
|
||||||
if (selectRecords.length == 0) {
|
if (selectRecords.length == 0) {
|
||||||
return ElMessage({
|
return ElMessage({
|
||||||
message: '请至少选择一台装置',
|
message: '请至少选择一台装置',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
dispositionRef.value.open({
|
dispositionRef.value.open({
|
||||||
title: name,
|
title: name,
|
||||||
id: selectRecords,
|
id: selectRecords,
|
||||||
key: key
|
key: key
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 流量统计
|
// 流量统计
|
||||||
const liultjData = () => {}
|
const liultjData = () => {}
|
||||||
// 重启前置程序
|
// 重启前置程序
|
||||||
const resect = () => {}
|
const resect = () => {}
|
||||||
|
|
||||||
// 终端详情
|
// 终端详情
|
||||||
const uesdealia = (row: any) => {
|
const uesdealia = (row: any) => {
|
||||||
detailRef.value.open(row)
|
detailRef.value.open(row)
|
||||||
}
|
}
|
||||||
// 流量详情
|
// 流量详情
|
||||||
const log = (row: any) => {
|
const log = (row: any) => {
|
||||||
logFlag.value = true
|
logFlag.value = true
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
logRef.value.open(row)
|
logRef.value.open(row)
|
||||||
}, 100)
|
}, 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 表格过滤
|
// 表格过滤
|
||||||
const searchEvent = debounce(() => {
|
const searchEvent = debounce(() => {
|
||||||
const filterVal = XEUtils.toValueString(tableStore.table.params.filterName).trim().toLowerCase()
|
const filterVal = XEUtils.toValueString(tableStore.table.params.filterName).trim().toLowerCase()
|
||||||
if (filterVal) {
|
if (filterVal) {
|
||||||
const options = { children: 'children' }
|
const options = { children: 'children' }
|
||||||
const searchProps = ['name']
|
const searchProps = ['name']
|
||||||
const rest = XEUtils.searchTree(
|
const rest = XEUtils.searchTree(
|
||||||
treeDataCopy.value,
|
treeDataCopy.value,
|
||||||
(item: any) => searchProps.some(key => String(item[key]).toLowerCase().indexOf(filterVal) > -1),
|
(item: any) => searchProps.some(key => String(item[key]).toLowerCase().indexOf(filterVal) > -1),
|
||||||
options
|
options
|
||||||
)
|
)
|
||||||
treeData.value = rest
|
treeData.value = rest
|
||||||
|
|
||||||
// 搜索之后默认展开所有子节点
|
// 搜索之后默认展开所有子节点
|
||||||
} else {
|
} else {
|
||||||
treeData.value = treeDataCopy.value
|
treeData.value = treeDataCopy.value
|
||||||
}
|
}
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const $table = tableRef.value
|
const $table = tableRef.value
|
||||||
if ($table) {
|
if ($table) {
|
||||||
$table.setAllTreeExpand(true)
|
$table.setAllTreeExpand(true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, 500)
|
}, 500)
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -54,14 +54,17 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item style="right: 500px; position: absolute; overflow: hidden">
|
<el-form-item style="right: 500px; position: absolute; overflow: hidden">
|
||||||
<LocationInformation style="width: 16px; margin-right: 8px; color: var(--el-color-primary)" />
|
<LocationInformation
|
||||||
<span style="font-size: 16px; font-weight: bold; color: var(--el-color-primary)">当前操作节点:</span>
|
style="width: 16px; margin-right: 8px; color: var(--el-color-primary)"
|
||||||
|
/>
|
||||||
|
<span style="font-size: 16px; font-weight: bold; color: var(--el-color-primary)">
|
||||||
|
当前操作节点:
|
||||||
|
</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item style="right: 0; position: absolute; overflow: hidden">
|
<el-form-item style="right: 0; position: absolute; overflow: hidden">
|
||||||
<div class="title" :class="titleList.length > 5 ? 'titleScroll' : ''">
|
<div class="title" :class="titleList.length > 5 ? 'titleScroll' : ''">
|
||||||
<span v-for="(item, index) in titleList">{{ index == 0 ? '' : ' > ' }}{{ item }}</span>
|
<span v-for="(item, index) in titleList">{{ index == 0 ? '' : ' > ' }}{{ item }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div id="scrollBox" :style="{ height: Height.height }" style="overflow-y: auto">
|
<div id="scrollBox" :style="{ height: Height.height }" style="overflow-y: auto">
|
||||||
@@ -1691,7 +1694,7 @@ import { useDictData } from '@/stores/dictData'
|
|||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { getYwZtSubstation } from '@/api/device-boot/device'
|
import { getYwZtSubstation } from '@/api/device-boot/device'
|
||||||
const size = ref(0)
|
const size = ref(23)
|
||||||
const TerminalRef = ref()
|
const TerminalRef = ref()
|
||||||
const pageHeight = mainHeight(20)
|
const pageHeight = mainHeight(20)
|
||||||
const Height = mainHeight(100)
|
const Height = mainHeight(100)
|
||||||
@@ -2024,12 +2027,12 @@ const latff: any = ref((rule: any, value: any, callback: any) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
const plevel = ref(0)
|
const plevel = ref(0)
|
||||||
const nodeDataList=ref()
|
const nodeDataList = ref()
|
||||||
const nodeEventList=ref()
|
const nodeEventList = ref()
|
||||||
const nodeLevel1=ref(0)
|
const nodeLevel1 = ref(0)
|
||||||
const nodeClick = (e: anyObj, data: any) => {
|
const nodeClick = (e: anyObj, data: any) => {
|
||||||
nodeDataList.value = data
|
nodeDataList.value = data
|
||||||
nodeEventList.value = e
|
nodeEventList.value = e
|
||||||
plevel.value = data.data.plevel
|
plevel.value = data.data.plevel
|
||||||
treeClickCount.value++
|
treeClickCount.value++
|
||||||
if (treeClickCount.value > 2) return
|
if (treeClickCount.value > 2) return
|
||||||
@@ -2338,7 +2341,9 @@ const next = async () => {
|
|||||||
break
|
break
|
||||||
case 600:
|
case 600:
|
||||||
addLine()
|
addLine()
|
||||||
selectChanged(AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].scale)
|
selectChanged(
|
||||||
|
AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].scale
|
||||||
|
)
|
||||||
nextfalg.value = false
|
nextfalg.value = false
|
||||||
break
|
break
|
||||||
case 700:
|
case 700:
|
||||||
@@ -2355,8 +2360,7 @@ const black = () => {
|
|||||||
busBarIndex.value = '0'
|
busBarIndex.value = '0'
|
||||||
deviceIndex.value = '0'
|
deviceIndex.value = '0'
|
||||||
lineIndex.value = '0'
|
lineIndex.value = '0'
|
||||||
nodeClick(nodeEventList.value,nodeDataList.value)
|
nodeClick(nodeEventList.value, nodeDataList.value)
|
||||||
|
|
||||||
}
|
}
|
||||||
// 确认提交
|
// 确认提交
|
||||||
const onsubmit = () => {
|
const onsubmit = () => {
|
||||||
@@ -3073,7 +3077,7 @@ const setDown = () => {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const dom = document.getElementById('navigation-splitpanes')
|
const dom = document.getElementById('navigation-splitpanes')
|
||||||
if (dom) {
|
if (dom) {
|
||||||
size.value = Math.round((180 / dom.offsetHeight) * 100)
|
size.value = Math.round((180 / dom.offsetHeight) * 120)
|
||||||
}
|
}
|
||||||
if (VITE_FLAG) {
|
if (VITE_FLAG) {
|
||||||
getYwZtSubstation({ orgId: '' }).then(res => {
|
getYwZtSubstation({ orgId: '' }).then(res => {
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="default-main">
|
<div class="default-main">
|
||||||
|
<div v-if="detailLoading" class="loading">
|
||||||
|
<el-spin description="加载中..." />
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
<el-descriptions :column="2" border>
|
<el-descriptions :column="2" border>
|
||||||
<el-descriptions-item label="所在地市">
|
<el-descriptions-item label="所在地市">
|
||||||
{{ detailData.city }}
|
{{ detailData.city }}
|
||||||
@@ -110,10 +114,7 @@
|
|||||||
>
|
>
|
||||||
{{ proviteData.agreementCapacity }}
|
{{ proviteData.agreementCapacity }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item
|
<el-descriptions-item label="装机容量(MW)">
|
||||||
label="装机容量(MW)"
|
|
||||||
|
|
||||||
>
|
|
||||||
{{ proviteData?.ratePower }}
|
{{ proviteData?.ratePower }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item
|
<el-descriptions-item
|
||||||
@@ -211,6 +212,7 @@
|
|||||||
}}
|
}}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
@@ -485,7 +487,7 @@ const getProviteData = async () => {
|
|||||||
getFileNamePath(proviteData.value.additionalAttachments, 'additionalAttachments')
|
getFileNamePath(proviteData.value.additionalAttachments, 'additionalAttachments')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 入网评估报告
|
// 系统接入方案
|
||||||
if (detailData.value.netInReport.length > 0) {
|
if (detailData.value.netInReport.length > 0) {
|
||||||
netInReportList.value = []
|
netInReportList.value = []
|
||||||
detailData.value.netInReport.forEach((item: any) => {
|
detailData.value.netInReport.forEach((item: any) => {
|
||||||
|
|||||||
161
src/views/pqs/cockpit/homePage/components/routingConfig.vue
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-dialog v-model="dialogVisible" title="设置" width="600">
|
||||||
|
<div style="display: flex; justify-content: end" class="mb10">
|
||||||
|
<el-button icon="el-icon-Plus" type="primary" @click="add">新增</el-button>
|
||||||
|
</div>
|
||||||
|
<div style="height: calc(100vh / 2); max-height: 400px">
|
||||||
|
<vxe-table
|
||||||
|
border
|
||||||
|
ref="tableRef"
|
||||||
|
:data="pageList.filter((item: any) => item.pagePath != 'dashboard/index')"
|
||||||
|
align="center"
|
||||||
|
height="auto"
|
||||||
|
v-bind="defaultAttribute"
|
||||||
|
>
|
||||||
|
<vxe-column field="pageName" title="菜单名称"></vxe-column>
|
||||||
|
|
||||||
|
<vxe-column field="icon" title="图标" width="80">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<Icon class="ba-icon-dark" :name="row.icon || ''" />
|
||||||
|
</template>
|
||||||
|
</vxe-column>
|
||||||
|
<vxe-column field="startTime" title="是否激活">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-switch
|
||||||
|
v-model="row.state"
|
||||||
|
inline-prompt
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
active-text="已激活"
|
||||||
|
inactive-text="未激活"
|
||||||
|
:before-change="() => beforeChange(row)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</vxe-column>
|
||||||
|
<vxe-column field="startTime" title="操作">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="primary" link @click="edit(row)">编辑</el-button>
|
||||||
|
|
||||||
|
<el-button type="danger" link @click="deletes(row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</vxe-column>
|
||||||
|
</vxe-table>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive } from 'vue'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import { defaultAttribute } from '@/components/table/defaultAttribute'
|
||||||
|
import { getDashboardPageByUserId, deleteDashboard, activatePage } from '@/api/system-boot/csstatisticalset'
|
||||||
|
import { useAdminInfo } from '@/stores/adminInfo'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
|
||||||
|
import { getMenu } from '@/utils/router'
|
||||||
|
|
||||||
|
const { push } = useRouter()
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const route = useRouter()
|
||||||
|
const adminInfo = useAdminInfo()
|
||||||
|
const pageList: any = ref([])
|
||||||
|
|
||||||
|
const open = () => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
init()
|
||||||
|
}
|
||||||
|
const init = () => {
|
||||||
|
getDashboardPageByUserId({ id: adminInfo.id, state: false }).then(res => {
|
||||||
|
pageList.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 新增
|
||||||
|
const add = () => {
|
||||||
|
push(`/admin/cockpit/popup?path=${String(getNextPagePath(pageList.value))}`)
|
||||||
|
}
|
||||||
|
// 修改
|
||||||
|
const edit = (row: any) => {
|
||||||
|
push(`/admin/cockpit/popup?id=${row?.id}&&path=${row.pagePath}`)
|
||||||
|
}
|
||||||
|
// 激活
|
||||||
|
const beforeChange = (row: any): Promise<boolean> => {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
// setTimeout(() => {
|
||||||
|
// loading1.value = false
|
||||||
|
// ElMessage.success('Switch success')
|
||||||
|
// return resolve(true)
|
||||||
|
// }, 1000)
|
||||||
|
ElMessageBox.confirm('此操作将激活该页面, 是否继续?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
activatePage({ id: row.id, state: row.state == 0 ? 1 : 0 }).then((res: any) => {
|
||||||
|
if (res.code == 'A0000') {
|
||||||
|
ElMessage({
|
||||||
|
type: 'success',
|
||||||
|
message: '操作成功!'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
init()
|
||||||
|
resolve(true)
|
||||||
|
getMenu()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
ElMessage({
|
||||||
|
type: 'info',
|
||||||
|
message: '已取消删除'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 删除
|
||||||
|
const deletes = (row: any) => {
|
||||||
|
ElMessageBox.confirm('此操作将永久删除该菜单, 是否继续?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
deleteDashboard({ id: row.id }).then((res: any) => {
|
||||||
|
if (res.code == 'A0000') {
|
||||||
|
ElMessage({
|
||||||
|
type: 'success',
|
||||||
|
message: '删除页面成功!'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
init()
|
||||||
|
getMenu()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
ElMessage({
|
||||||
|
type: 'info',
|
||||||
|
message: '已取消删除'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function getNextPagePath(pages: any) {
|
||||||
|
// 提取所有pagePath中的数字部分
|
||||||
|
const numbers = pages.map((page: any) => {
|
||||||
|
const match = page.pagePath.match(/dashboard\/index(\d*)$/)
|
||||||
|
if (match && match[1]) {
|
||||||
|
return parseInt(match[1], 10)
|
||||||
|
}
|
||||||
|
return 0 // 没有数字时视为0
|
||||||
|
})
|
||||||
|
|
||||||
|
// 找到最大数字并加1
|
||||||
|
const maxNum = Math.max(...numbers)
|
||||||
|
const nextNum = maxNum + 1
|
||||||
|
|
||||||
|
// 生成下一个pagePath
|
||||||
|
return `dashboard/index${nextNum}`
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({ open })
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
@@ -1,245 +1,338 @@
|
|||||||
<template>
|
<template>
|
||||||
<GridLayout
|
<div class="default-main">
|
||||||
class="default-main"
|
<TableHeader :showSearch="false" v-show="flag">
|
||||||
v-model:layout="layout"
|
<template v-slot:select>
|
||||||
:row-height="rowHeight"
|
<el-form-item label="统计时间">
|
||||||
:is-resizable="false"
|
<DatePicker
|
||||||
:is-draggable="false"
|
ref="datePickerRef"
|
||||||
:responsive="false"
|
:nextFlag="false"
|
||||||
:vertical-compact="false"
|
:theCurrentTime="true"
|
||||||
prevent-collision
|
@change="handleDatePickerChange"
|
||||||
:col-num="12"
|
></DatePicker>
|
||||||
>
|
</el-form-item>
|
||||||
<template #item="{ item }">
|
</template>
|
||||||
<div class="box">
|
<template v-slot:operation>
|
||||||
<div class="title">
|
<el-button type="primary" icon="el-icon-Edit" @click="editd">编辑</el-button>
|
||||||
<div style="display: flex; align-items: center">
|
<!-- <el-button type="primary" icon="el-icon-Tools" @click="settings">设置</el-button> -->
|
||||||
<Icon class="HelpFilled" :name="item.icon" />
|
</template>
|
||||||
{{ item.name }}
|
</TableHeader>
|
||||||
</div>
|
|
||||||
<!-- <FullScreen class="HelpFilled" style="cursor: pointer" @click="zoom(item)" /> -->
|
<GridLayout
|
||||||
<img :src="flag ? img : img1" style="cursor: pointer; height: 16px" @click="zoom(item)" />
|
v-model:layout="layout"
|
||||||
</div>
|
:row-height="rowHeight"
|
||||||
<div>
|
:is-resizable="false"
|
||||||
<component
|
:is-draggable="false"
|
||||||
:is="item.component"
|
:responsive="false"
|
||||||
v-if="item.component"
|
:vertical-compact="false"
|
||||||
class="pd10"
|
prevent-collision
|
||||||
:key="key"
|
:col-num="12"
|
||||||
:height="rowHeight * item.h - (item.h == 6 ? -20 : item.h == 2 ? 20 : 5) + 'px'"
|
>
|
||||||
:width="rowWidth * item.w - 5 + 'px'"
|
<template #item="{ item }">
|
||||||
:timeKey="item.timeKey"
|
<div class="box">
|
||||||
/>
|
<div class="title">
|
||||||
<div v-else class="pd10">组件加载失败...</div>
|
<div style="display: flex; align-items: center">
|
||||||
</div>
|
<Icon class="HelpFilled" :name="(item as LayoutItem).icon" />
|
||||||
</div>
|
{{ (item as LayoutItem).name }}
|
||||||
</template>
|
</div>
|
||||||
</GridLayout>
|
<!-- <FullScreen class="HelpFilled" style="cursor: pointer" @click="zoom(item)" /> -->
|
||||||
</template>
|
<img :src="flag ? img : img1" style="cursor: pointer; height: 16px" @click="zoom(item)" />
|
||||||
|
</div>
|
||||||
<script setup lang="ts">
|
<div>
|
||||||
import { ref, reactive, onMounted, markRaw, onUnmounted, defineAsyncComponent, type Component } from 'vue'
|
<component
|
||||||
import { GridLayout } from 'grid-layout-plus'
|
:is="(item as LayoutItem).component"
|
||||||
import { useDebounceFn } from '@vueuse/core'
|
v-if="(item as LayoutItem).component"
|
||||||
import { queryActivatePage } from '@/api/system-boot/csstatisticalset'
|
class="pd10"
|
||||||
import { HelpFilled, FullScreen } from '@element-plus/icons-vue'
|
:key="key"
|
||||||
// defineOptions({
|
:timeValue="datePickerRef?.timeValue || 3"
|
||||||
// name: 'cockpit/homePage'
|
:height="rowHeight * item.h - seRowHeight(item.h) + 'px'"
|
||||||
// })
|
:width="rowWidth * item.w - 30 + 'px'"
|
||||||
// 定义类型
|
:timeKey="(item as LayoutItem).timeKey"
|
||||||
interface LayoutItem {
|
:interval="datePickerRef?.interval"
|
||||||
x: number
|
:w="item.w"
|
||||||
y: number
|
:h="item.h"
|
||||||
w: number
|
/>
|
||||||
h: number
|
<div v-else class="pd10">组件加载失败...</div>
|
||||||
i: string | number
|
</div>
|
||||||
name: string
|
</div>
|
||||||
path: string
|
</template>
|
||||||
component?: Component | string
|
</GridLayout>
|
||||||
loading?: boolean
|
<!-- 设置 -->
|
||||||
error?: any
|
<RoutingConfig ref="RoutingConfigRef" />
|
||||||
}
|
</div>
|
||||||
const key = ref(0)
|
</template>
|
||||||
const img = new URL(`@/assets/imgs/amplify.png`, import.meta.url)
|
|
||||||
const img1 = new URL(`@/assets/imgs/reduce.png`, import.meta.url)
|
<script setup lang="ts">
|
||||||
// 响应式数据
|
import { ref, reactive, onMounted, markRaw, onUnmounted, computed, defineAsyncComponent, type Component } from 'vue'
|
||||||
const rowHeight = ref(0)
|
import TableHeader from '@/components/table/header/index.vue'
|
||||||
const rowWidth = ref(0)
|
import { GridLayout } from 'grid-layout-plus'
|
||||||
const layout = ref<LayoutItem[]>([
|
import DatePicker from '@/components/form/datePicker/index.vue'
|
||||||
// {
|
import { useDebounceFn } from '@vueuse/core'
|
||||||
// x: 4,
|
import { queryActivatePage, queryByPagePath } from '@/api/system-boot/csstatisticalset'
|
||||||
// y: 0,
|
import RoutingConfig from '@/views/pqs/cockpit/homePage/components/routingConfig.vue'
|
||||||
// w: 4,
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
// h: 2,
|
import { useTimeCacheStore } from '@/stores/timeCache'
|
||||||
// i: '1',
|
const { push } = useRouter()
|
||||||
// name: '',
|
const datePickerRef = ref()
|
||||||
// path: '/src/views/pqs/runManage/assessment/components/uese/index.vue'
|
const router = useRouter()
|
||||||
// },
|
const route = useRoute()
|
||||||
])
|
const timeCacheStore = useTimeCacheStore()
|
||||||
const layoutCopy = ref<LayoutItem[]>([])
|
|
||||||
const flag = ref(true)
|
defineOptions({
|
||||||
// 组件映射
|
// name: 'dashboard/index'
|
||||||
const componentMap = reactive(new Map<string, Component | string>())
|
})
|
||||||
|
// 定义类型
|
||||||
// 获取主内容区域高度
|
interface LayoutItem {
|
||||||
const getMainHeight = () => {
|
x: number
|
||||||
const elMain = document.querySelector('.el-main')
|
y: number
|
||||||
return (elMain?.offsetHeight || 0) - 70
|
w: number
|
||||||
}
|
h: number
|
||||||
// 获取主内容区域高度
|
timeKey: number | string
|
||||||
const getMainWidth = () => {
|
i: string | number
|
||||||
const elMain = document.querySelector('.el-main')
|
name: string
|
||||||
return (elMain?.offsetWidth || 0) - 20
|
path: string
|
||||||
}
|
icon?: string // 新增 icon 可选字段
|
||||||
|
component?: Component | string
|
||||||
// 初始化行高
|
loading?: boolean
|
||||||
const initRowHeight = () => {
|
error?: any
|
||||||
rowHeight.value = Math.max(0, (getMainHeight() - 20) / 6)
|
}
|
||||||
rowWidth.value = Math.max(0, getMainWidth() / 12)
|
const RoutingConfigRef = ref()
|
||||||
}
|
const key = ref(0)
|
||||||
|
const img = new URL(`@/assets/img/amplify.png`, import.meta.url).href
|
||||||
// 动态注册组件
|
const img1 = new URL(`@/assets/img/reduce.png`, import.meta.url).href
|
||||||
const registerComponent = (path: string): Component | string | null => {
|
// 响应式数据
|
||||||
if (!path) return null
|
const rowHeight = ref(0)
|
||||||
|
const rowWidth = ref(0)
|
||||||
const cacheKey = path
|
const layout: any = ref([
|
||||||
|
// {
|
||||||
// 使用缓存的组件
|
// x: 4,
|
||||||
if (componentMap.has(cacheKey)) {
|
// y: 0,
|
||||||
return componentMap.get(cacheKey)!
|
// w: 4,
|
||||||
}
|
// h: 2,
|
||||||
|
// i: '1',
|
||||||
try {
|
// name: '',
|
||||||
// 动态导入组件
|
// path: '/src/views/pqs/runManage/assessment/components/uese/index.vue'
|
||||||
const modules = import.meta.glob('@/views/**/*.vue')
|
// },
|
||||||
if (!modules[path]) {
|
])
|
||||||
console.error(`组件加载失败: ${path}`)
|
const layoutCopy: any = ref([])
|
||||||
return null
|
const flag = ref(true)
|
||||||
}
|
// 组件映射
|
||||||
|
const componentMap = reactive(new Map<string, Component | string>())
|
||||||
const AsyncComponent = defineAsyncComponent({
|
const dataList: any = ref({})
|
||||||
loader: modules[path],
|
// 获取主内容区域高度
|
||||||
loadingComponent: () => h('div', '加载中...'),
|
const getMainHeight = () => {
|
||||||
errorComponent: ({ error }) => h('div', `加载错误: ${error.message}`),
|
const elMain = document.querySelector('.el-main')
|
||||||
delay: 200,
|
return (elMain?.offsetHeight || 0) - 70
|
||||||
timeout: 10000
|
}
|
||||||
})
|
// 获取主内容区域高度
|
||||||
|
const getMainWidth = () => {
|
||||||
// 保存到映射中
|
const elMain = document.querySelector('.el-main')
|
||||||
componentMap.set(cacheKey, markRaw(AsyncComponent))
|
return (elMain?.offsetWidth || 0) - 20
|
||||||
return AsyncComponent
|
}
|
||||||
} catch (error) {
|
|
||||||
console.error('注册组件失败:', error)
|
// 初始化行高
|
||||||
return null
|
const initRowHeight = () => {
|
||||||
}
|
rowHeight.value = Math.max(0, (getMainHeight() - 77 + (flag.value ? 0 : 56)) / 6)
|
||||||
}
|
rowWidth.value = Math.max(0, getMainWidth() / 12)
|
||||||
// 缩放
|
}
|
||||||
const zoom = (value: any) => {
|
|
||||||
if (flag.value) {
|
// 动态注册组件
|
||||||
layout.value = [{ ...value, x: 0, y: 0, w: 12, h: 6 }]
|
const registerComponent = (path: string): Component | string | null => {
|
||||||
} else {
|
if (!path) return null
|
||||||
layout.value = layoutCopy.value.map((item, index) => ({
|
|
||||||
...item,
|
const cacheKey = path
|
||||||
i: item.i || index, // 确保有唯一标识
|
|
||||||
component: registerComponent(item.path)
|
// 使用缓存的组件
|
||||||
}))
|
if (componentMap.has(cacheKey)) {
|
||||||
}
|
return componentMap.get(cacheKey)!
|
||||||
flag.value = !flag.value
|
}
|
||||||
key.value += 1
|
|
||||||
}
|
try {
|
||||||
// 获取布局数据
|
// 动态导入组件
|
||||||
const fetchLayoutData = async () => {
|
const modules = import.meta.glob('@/**/*.vue')
|
||||||
try {
|
if (!modules[path]) {
|
||||||
const { data } = await queryActivatePage()
|
console.error(`组件加载失败: ${path}`)
|
||||||
const parsedLayout = JSON.parse(data.containerConfig || '[]') as LayoutItem[]
|
return null
|
||||||
// 处理布局数据
|
}
|
||||||
layout.value = parsedLayout.map((item, index) => ({
|
|
||||||
...item,
|
const AsyncComponent = defineAsyncComponent({
|
||||||
i: item.i || index, // 确保有唯一标识
|
loader: modules[path],
|
||||||
component: registerComponent(item.path)
|
loadingComponent: () => h('div', '加载中...'),
|
||||||
}))
|
errorComponent: ({ error }) => h('div', `加载错误: ${error.message}`),
|
||||||
layoutCopy.value = JSON.parse(JSON.stringify(layout.value))
|
delay: 200,
|
||||||
} catch (error) {
|
timeout: 10000
|
||||||
console.error('获取布局数据失败:', error)
|
})
|
||||||
// 可以添加错误提示逻辑
|
|
||||||
}
|
// 保存到映射中
|
||||||
}
|
componentMap.set(cacheKey, markRaw(AsyncComponent))
|
||||||
|
return AsyncComponent
|
||||||
// 窗口大小变化处理 - 使用防抖
|
} catch (error) {
|
||||||
const handleResize = useDebounceFn(() => {
|
console.error('注册组件失败:', error)
|
||||||
initRowHeight()
|
return null
|
||||||
key.value += 1
|
}
|
||||||
}, 200)
|
}
|
||||||
|
// 缩放
|
||||||
// 生命周期钩子
|
const zoom = (value: any) => {
|
||||||
onMounted(() => {
|
if (flag.value) {
|
||||||
initRowHeight()
|
layout.value = [{ ...value, x: 0, y: 0, w: 12, h: 6 }]
|
||||||
fetchLayoutData()
|
} else {
|
||||||
|
layout.value = layoutCopy.value.map((item: any, index: number) => ({
|
||||||
// 添加窗口大小变化监听器
|
...item,
|
||||||
window.addEventListener('resize', handleResize)
|
i: item.i || index, // 确保有唯一标识
|
||||||
})
|
component: registerComponent(item.path)
|
||||||
|
}))
|
||||||
onUnmounted(() => {
|
}
|
||||||
// 移除监听器防止内存泄漏
|
console.log('🚀 ~ zoom ~ layout.value:', layout.value)
|
||||||
window.removeEventListener('resize', handleResize)
|
|
||||||
})
|
flag.value = !flag.value
|
||||||
</script>
|
|
||||||
|
initRowHeight()
|
||||||
<style lang="scss" scoped>
|
key.value += 1
|
||||||
.vgl-layout {
|
}
|
||||||
background-color: #f8f9fa;
|
// 计算组件高度
|
||||||
border-radius: 4px;
|
const seRowHeight = (value: any) => {
|
||||||
overflow: hidden;
|
if (value == 6) return 0
|
||||||
}
|
if (value == 5) return 12
|
||||||
|
if (value == 4) return 20
|
||||||
:deep(.vgl-item:not(.vgl-item--placeholder)) {
|
if (value == 3) return 30
|
||||||
background-color: #ffffff;
|
if (value == 2) return 40
|
||||||
border-radius: 4px;
|
if (value == 1) return 50
|
||||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
|
return 0
|
||||||
transition: all 0.3s ease;
|
}
|
||||||
}
|
|
||||||
|
// 获取布局数据
|
||||||
:deep(.vgl-item:hover:not(.vgl-item--placeholder)) {
|
const fetchLayoutData = async () => {
|
||||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.12);
|
try {
|
||||||
}
|
// const { data } = await queryByPagePath({ pagePath: router.currentRoute.value.name })
|
||||||
|
// dataList.value = data
|
||||||
:deep(.vgl-item--static) {
|
dataList.value = {
|
||||||
background-color: #f0f2f5;
|
createBy: 'e6a67ccbe789493687766c4304fcb228',
|
||||||
}
|
createTime: '2025-11-26 08:43:56',
|
||||||
|
updateBy: 'e6a67ccbe789493687766c4304fcb228',
|
||||||
.text {
|
updateTime: '2025-11-26 08:43:56',
|
||||||
position: absolute;
|
id: 'e8218545cc11e32d5d6b87c92fdd0fbc',
|
||||||
inset: 0;
|
pageName: '测试',
|
||||||
display: flex;
|
thumbnail: '',
|
||||||
align-items: center;
|
remark: '',
|
||||||
justify-content: center;
|
containerConfig:
|
||||||
font-size: 16px;
|
'[{"x":0,"y":0,"w":6,"h":3,"i":0.9274640143002512,"name":"终端在线率","path":"/src/components/cockpit/onlineRate/index.vue","icon":"local-审计列表","timeKey":"3","moved":false},{"x":6,"y":0,"w":6,"h":3,"i":0.9154814002445102,"name":"监测点数据完整性","path":"/src/components/cockpit/integrity/index.vue","icon":"local-告警中心","timeKey":"3","moved":false},{"x":0,"y":3,"w":6,"h":3,"i":0.6560899767923003,"name":"终端运行评价","path":"/src/components/cockpit/terminalEvaluation/index.vue","icon":"local-稳态指标超标明细","timeKey":"3","moved":false},{"x":6,"y":3,"w":6,"h":3,"i":0.5812302648025226,"name":"异常数据清洗","path":"/src/components/cockpit/dataCleaning/index.vue","icon":"local-区域暂态评估","timeKey":"3","moved":false}]',
|
||||||
color: #606266;
|
sort: 100,
|
||||||
}
|
state: 1,
|
||||||
|
pagePath: 'dashboard/index6',
|
||||||
:deep(.vgl-item) {
|
pathName: null,
|
||||||
overflow: hidden;
|
routeName: '/src/views/pqs/cockpit/homePage/index.vue',
|
||||||
}
|
icon: ''
|
||||||
.box {
|
}
|
||||||
overflow: hidden;
|
const parsedLayout = JSON.parse(dataList.value.containerConfig || '[]') as LayoutItem[]
|
||||||
.title {
|
// 处理布局数据
|
||||||
border-bottom: 1px solid #000;
|
layout.value = parsedLayout.map((item, index) => ({
|
||||||
font-size: 14px;
|
...item,
|
||||||
height: 30px;
|
i: item.i || index, // 确保有唯一标识
|
||||||
font-weight: 600;
|
component: registerComponent(item.path)
|
||||||
padding: 0px 10px;
|
}))
|
||||||
color: #fff;
|
layoutCopy.value = JSON.parse(JSON.stringify(layout.value))
|
||||||
background-color: var(--el-color-primary);
|
initRowHeight()
|
||||||
display: flex;
|
} catch (error) {
|
||||||
align-items: center;
|
console.error('获取布局数据失败:', error)
|
||||||
justify-content: space-between;
|
// 可以添加错误提示逻辑
|
||||||
}
|
}
|
||||||
.HelpFilled {
|
}
|
||||||
height: 16px;
|
|
||||||
width: 16px;
|
// 窗口大小变化处理 - 使用防抖
|
||||||
color: #fff !important;
|
const handleResize = useDebounceFn(() => {
|
||||||
margin-right: 5px;
|
initRowHeight()
|
||||||
}
|
// key.value += 1
|
||||||
}
|
}, 200)
|
||||||
</style>
|
|
||||||
|
// 修改
|
||||||
|
const editd = (e: any) => {
|
||||||
|
if (dataList.value?.id) {
|
||||||
|
push(`/admin/cockpit/popup?id=${dataList.value?.id}&&path=${String(router.currentRoute.value.name)}`)
|
||||||
|
} else {
|
||||||
|
push(`/admin/cockpit/popup?path=${String(router.currentRoute.value.name)}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 设置
|
||||||
|
const settings = () => {
|
||||||
|
RoutingConfigRef.value.open()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理 DatePicker 值变化事件
|
||||||
|
const handleDatePickerChange = (value: any) => {
|
||||||
|
// 将值缓存到 timeCache
|
||||||
|
if (value) {
|
||||||
|
timeCacheStore.setCache(route.path, value.interval, value.timeValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生命周期钩子
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
459
src/views/pqs/cockpit/realTimeData/iframeDia.vue
Normal file
@@ -0,0 +1,459 @@
|
|||||||
|
<template>
|
||||||
|
<div class="container">
|
||||||
|
<!-- 使用 v-for 遍历四个角落 -->
|
||||||
|
<div v-for="corner in corners" v-show="corner.show" :key="corner.id" :class="['corner', corner.className]">
|
||||||
|
<div class="content">
|
||||||
|
<div class="title" style="display: flex">
|
||||||
|
<img src="@/assets/img/lightning.png" class="title_img" />
|
||||||
|
<span>{{ corner.title }}</span>
|
||||||
|
</div>
|
||||||
|
<vxe-table
|
||||||
|
:data="corner.data"
|
||||||
|
size="small"
|
||||||
|
border
|
||||||
|
show-header
|
||||||
|
:header-cell-style="{ textAlign: 'center' }"
|
||||||
|
:cell-style="{ textAlign: 'center' }"
|
||||||
|
height="200"
|
||||||
|
style="padding: 5px;"
|
||||||
|
>
|
||||||
|
<vxe-column field="name" title="名称"></vxe-column>
|
||||||
|
<vxe-column field="a" title="A" width="40"></vxe-column>
|
||||||
|
<vxe-column field="b" title="B" width="40"></vxe-column>
|
||||||
|
<vxe-column field="c" title="C" width="40"></vxe-column>
|
||||||
|
</vxe-table>
|
||||||
|
</div>
|
||||||
|
<span class="close-btn" @click="closeCorner(corner.id)">
|
||||||
|
<Close />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, onMounted, onBeforeUnmount, nextTick, reactive } from 'vue'
|
||||||
|
// import { clickImage } from "@/api/manage_wx";
|
||||||
|
import { Close } from '@element-plus/icons-vue'
|
||||||
|
import socketClient from '@/utils/webSocketClient'
|
||||||
|
|
||||||
|
//开始创建webSocket客户端
|
||||||
|
const dataSocket = reactive({
|
||||||
|
socketServe: socketClient.Instance
|
||||||
|
})
|
||||||
|
// 定义四个角落的数据
|
||||||
|
const corners = ref([
|
||||||
|
{
|
||||||
|
id: 'topLeft',
|
||||||
|
title: '左上',
|
||||||
|
className: 'top-left',
|
||||||
|
show: false,
|
||||||
|
data: [
|
||||||
|
{ name: '电压', a: 1098, b: 2080, c: 3006 },
|
||||||
|
{ name: '电流', a: 15, b: 25, c: 35 },
|
||||||
|
{ name: '电压畸变率', a: 12, b: 22, c: 32 },
|
||||||
|
{ name: '电流畸变率', a: 18, b: 28, c: 38 },
|
||||||
|
{ name: '电压偏值', a: 12, b: 22, c: 32 },
|
||||||
|
{ name: '电压不平衡', a: 18, b: 28, c: 38 }
|
||||||
|
] as any[],
|
||||||
|
elementId: '', // 记录该角落对应的元素ID
|
||||||
|
raceLists: [] as any[] // 为每个角落添加独立的跑马灯数据存储
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'topRight',
|
||||||
|
title: '右上',
|
||||||
|
className: 'top-right',
|
||||||
|
show: false,
|
||||||
|
data: [] as any[],
|
||||||
|
elementId: '',
|
||||||
|
raceLists: [] as any[] // 为每个角落添加独立的跑马灯数据存储
|
||||||
|
}
|
||||||
|
// {
|
||||||
|
// id: "bottomLeft",
|
||||||
|
// title: "左下",
|
||||||
|
// className: "bottom-left",
|
||||||
|
// show: false,
|
||||||
|
// data: [] as { label: string; value: string }[],
|
||||||
|
// elementId: "",
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: "bottomRight",
|
||||||
|
// title: "右下",
|
||||||
|
// className: "bottom-right",
|
||||||
|
// show: false,
|
||||||
|
// data: [] as { label: string; value: string }[],
|
||||||
|
// elementId: "",
|
||||||
|
// },
|
||||||
|
])
|
||||||
|
|
||||||
|
interface DataTableItem {
|
||||||
|
name: string
|
||||||
|
a: number
|
||||||
|
b: number
|
||||||
|
c: number
|
||||||
|
}
|
||||||
|
|
||||||
|
const tableData = ref<DataTableItem[]>([
|
||||||
|
{ name: '电压', a: 1098, b: 2080, c: 3006 },
|
||||||
|
{ name: '电流', a: 15, b: 25, c: 35 },
|
||||||
|
{ name: '电压畸变率', a: 12, b: 22, c: 32 },
|
||||||
|
{ name: '电流畸变率', a: 18, b: 28, c: 38 },
|
||||||
|
{ name: '电压偏值', a: 12, b: 22, c: 32 },
|
||||||
|
{ name: '电压不平衡', a: 18, b: 28, c: 38 }
|
||||||
|
])
|
||||||
|
|
||||||
|
const steadyStateList = ref([])
|
||||||
|
|
||||||
|
const selectedId = ref('')
|
||||||
|
|
||||||
|
// 内部响应式数据
|
||||||
|
const eventList = ref<any[]>([])
|
||||||
|
|
||||||
|
// const handleClickImage = async (elementId: string) => {
|
||||||
|
// // 检查 elementId 是否有值,没有值则直接返回空数组
|
||||||
|
// if (!elementId) {
|
||||||
|
// eventList.value = [];
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// try {
|
||||||
|
// // 发送点击图片请求
|
||||||
|
// const res = await clickImage({ lineId: elementId });
|
||||||
|
|
||||||
|
// // 确保返回的数据是数组格式,并且过滤掉 null/undefined 元素
|
||||||
|
// let dataToStore: any[] = [];
|
||||||
|
|
||||||
|
// if (Array.isArray(res.data)) {
|
||||||
|
// dataToStore = res.data.filter(
|
||||||
|
// (item:any) => item !== null && item !== undefined
|
||||||
|
// );
|
||||||
|
// } else if (res.data && Array.isArray(res.data.records)) {
|
||||||
|
// dataToStore = res.data.records.filter(
|
||||||
|
// (item:any) => item !== null && item !== undefined
|
||||||
|
// );
|
||||||
|
// } else if (res.data) {
|
||||||
|
// // 如果是单个对象且不为 null
|
||||||
|
// if (res.data !== null && res.data !== undefined) {
|
||||||
|
// dataToStore = [res.data];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// eventList.value = dataToStore;
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error("调用 clickImage 接口出错:", error);
|
||||||
|
// // 出错时设置为空数组,避免后续处理出错
|
||||||
|
// eventList.value = [];
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
|
// 记录显示顺序,用于循环替换
|
||||||
|
const displayOrder = ref<number[]>([])
|
||||||
|
|
||||||
|
// 更新指定角落数据的函数
|
||||||
|
const updateCornerData = (cornerIndex: number, dataItem: any, elementId: string) => {
|
||||||
|
// 更新标题为 objName
|
||||||
|
if (dataItem.objName) {
|
||||||
|
corners.value[cornerIndex].title = dataItem.objName
|
||||||
|
} else {
|
||||||
|
corners.value[cornerIndex].title = dataItem.stationName
|
||||||
|
}
|
||||||
|
|
||||||
|
// 格式化数据
|
||||||
|
corners.value[cornerIndex].data = [
|
||||||
|
{ label: '监测点', value: dataItem.lineName },
|
||||||
|
// {
|
||||||
|
// label: "暂降次数",
|
||||||
|
// value: dataItem.eventIds.length,
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
label: '暂降次数',
|
||||||
|
value: ``
|
||||||
|
},
|
||||||
|
// { label: "稳态指标", value: "Ua:65.5 Ub:65.02 Uc:65.27 Uac:112.85 Uab:112.67 Ubc:112.85" },
|
||||||
|
{
|
||||||
|
label: '稳态指标',
|
||||||
|
value: ``
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
// 记录该角落对应的元素ID
|
||||||
|
corners.value[cornerIndex].elementId = elementId
|
||||||
|
corners.value[cornerIndex].show = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 显示下一个角落的函数
|
||||||
|
const showNextCorner = (elementId: string) => {
|
||||||
|
// 检查该元素ID是否已经显示过
|
||||||
|
const existingCornerIndex = corners.value.findIndex(corner => corner.elementId === elementId && corner.show)
|
||||||
|
|
||||||
|
if (existingCornerIndex !== -1) {
|
||||||
|
// 如果该元素已经显示过,不更新数据
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确保 eventList.value 是数组并且过滤掉 null/undefined 元素
|
||||||
|
if (!Array.isArray(eventList.value)) {
|
||||||
|
console.warn('eventList.value 不是数组格式:', eventList.value)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 过滤掉 null 和 undefined 元素,然后查找匹配项
|
||||||
|
const validItems = eventList.value.filter(item => item !== null && item !== undefined)
|
||||||
|
const dataItem = validItems.find(item => item.lineId === elementId)
|
||||||
|
|
||||||
|
// 如果没有找到匹配的数据项,则不更新数据
|
||||||
|
if (!dataItem) {
|
||||||
|
console.warn('未找到匹配的数据项:', elementId)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查找一个未显示的角落
|
||||||
|
const availableCornerIndex = corners.value.findIndex(corner => !corner.show)
|
||||||
|
|
||||||
|
if (availableCornerIndex !== -1) {
|
||||||
|
// 有空闲角落,显示在该角落
|
||||||
|
updateCornerData(availableCornerIndex, dataItem, elementId)
|
||||||
|
// 将事件数据存储到该角落
|
||||||
|
corners.value[availableCornerIndex].raceLists = dataItem.eventList || []
|
||||||
|
// 记录显示顺序
|
||||||
|
displayOrder.value.push(availableCornerIndex)
|
||||||
|
} else {
|
||||||
|
// 没有空闲角落,按顺序替换角落
|
||||||
|
// 获取需要替换的角落索引(循环替换)
|
||||||
|
const replaceIndex = displayOrder.value.shift() || 0
|
||||||
|
updateCornerData(replaceIndex, dataItem, elementId)
|
||||||
|
// 将事件数据存储到该角落
|
||||||
|
corners.value[replaceIndex].raceLists = dataItem.eventList || []
|
||||||
|
// 将替换的索引重新加入队列末尾
|
||||||
|
displayOrder.value.push(replaceIndex)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关闭指定角落的函数
|
||||||
|
const closeCorner = (id: string) => {
|
||||||
|
const cornerIndex = corners.value.findIndex(c => c.id === id)
|
||||||
|
if (cornerIndex !== -1) {
|
||||||
|
corners.value[cornerIndex].show = false
|
||||||
|
corners.value[cornerIndex].elementId = '' // 清空元素ID记录
|
||||||
|
|
||||||
|
// 从显示顺序中移除该角落索引
|
||||||
|
const orderIndex = displayOrder.value.indexOf(cornerIndex)
|
||||||
|
if (orderIndex !== -1) {
|
||||||
|
displayOrder.value.splice(orderIndex, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
send()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关闭所有角落的函数
|
||||||
|
const closeAllCorners = () => {
|
||||||
|
corners.value.forEach(corner => {
|
||||||
|
corner.show = false
|
||||||
|
corner.elementId = ''
|
||||||
|
})
|
||||||
|
displayOrder.value = []
|
||||||
|
}
|
||||||
|
|
||||||
|
// 组件挂载后初始化监听器
|
||||||
|
onMounted(() => {
|
||||||
|
init()
|
||||||
|
// 初始化时不显示任何内容
|
||||||
|
})
|
||||||
|
|
||||||
|
// 连接webSocket客户端
|
||||||
|
const init = () => {
|
||||||
|
if (!dataSocket.socketServe) {
|
||||||
|
console.error('WebSocket 客户端实例不存在')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dataSocket.socketServe.connect(new Date().getTime())
|
||||||
|
dataSocket.socketServe.registerCallBack('message', (res: any) => {
|
||||||
|
if (res.type == 1) {
|
||||||
|
//稳态指标数据
|
||||||
|
let steadyState = JSON.parse(res.message)
|
||||||
|
|
||||||
|
// console.log(steadyState, "8990hhhhh");
|
||||||
|
if (steadyState == null || steadyState.length == 0) return
|
||||||
|
steadyStateList.value = steadyState
|
||||||
|
corners.value.forEach((corner, index) => {
|
||||||
|
let str = ``
|
||||||
|
steadyState
|
||||||
|
.filter((item: any) => item.lineId == corner.elementId)
|
||||||
|
.forEach((item: any) => {
|
||||||
|
if (item.value == 3.1415926) {
|
||||||
|
str += `<div>${item.statisticalName}:/</div>`
|
||||||
|
} else {
|
||||||
|
str += `<div>${item.statisticalName}:${item.value}${item.unit}</div>`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
corner.data.length > 0
|
||||||
|
? (corner.data[2].value = `<div style="max-height: 100px;overflow-y: auto;">${str} </div>`)
|
||||||
|
: ''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const time = ref(null)
|
||||||
|
// 推送消息
|
||||||
|
const send = () => {
|
||||||
|
dataSocket.socketServe.send({
|
||||||
|
pageId: selectedId.value,
|
||||||
|
lineIdList: corners.value.filter(item => item.show == true).map(corner => corner.elementId)
|
||||||
|
})
|
||||||
|
if (time.value) {
|
||||||
|
clearTimeout(time.value)
|
||||||
|
}
|
||||||
|
if (corners.value.filter(item => item.show == true).map(corner => corner.elementId).length == 0) return
|
||||||
|
time.value = setInterval(() => {
|
||||||
|
dataSocket.socketServe.send({
|
||||||
|
pageId: selectedId.value,
|
||||||
|
lineIdList: corners.value.filter(item => item.show == true).map(corner => corner.elementId)
|
||||||
|
})
|
||||||
|
}, 1000 * 60)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听来自 iframe 的消息
|
||||||
|
window.addEventListener('message', async function (event) {
|
||||||
|
// 安全起见,可以验证消息来源(origin)
|
||||||
|
// if (event.origin !== 'https://trusted-origin.com') return;
|
||||||
|
|
||||||
|
// 处理从 iframe 发送过来的消息
|
||||||
|
if (event.data.action === 'coreClick') {
|
||||||
|
const clickedElementId = event.data.coreId
|
||||||
|
selectedId.value = event.data.selectedId
|
||||||
|
|
||||||
|
// 调用接口获取最新数据
|
||||||
|
// await handleClickImage(clickedElementId);
|
||||||
|
|
||||||
|
// 根据接收到的元素LineId显示对应数据
|
||||||
|
await showNextCorner(clickedElementId)
|
||||||
|
|
||||||
|
await send()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 页面卸载时清除定时器
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
clearTimeout(time.value)
|
||||||
|
dataSocket.socketServe?.closeWs()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.container {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.corner {
|
||||||
|
width: 240px;
|
||||||
|
/* height: 135px; */
|
||||||
|
background-color: #fff;
|
||||||
|
position: absolute;
|
||||||
|
color: #000;
|
||||||
|
/* font-weight: bold; */
|
||||||
|
/* 添加弹出动画 */
|
||||||
|
opacity: 0;
|
||||||
|
transform: scale(0.3);
|
||||||
|
transition: all 0.4s ease-out;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 显示状态的样式 */
|
||||||
|
.corner:not([style*='display: none']):not([style*='display:none']) {
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-left {
|
||||||
|
top: 10px;
|
||||||
|
left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-right {
|
||||||
|
top: 10px;
|
||||||
|
right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-left {
|
||||||
|
top: 170px;
|
||||||
|
left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-right {
|
||||||
|
top: 170px;
|
||||||
|
right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 16px;
|
||||||
|
// text-align: center;
|
||||||
|
padding: 5px;
|
||||||
|
color: #fff;
|
||||||
|
border-bottom: 1px solid #444;
|
||||||
|
background-color: var(--el-color-primary);
|
||||||
|
border-radius: 8px 8px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title_img {
|
||||||
|
width: 25px;
|
||||||
|
height: 25px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-item {
|
||||||
|
display: flex;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
/* font-weight: bold; */
|
||||||
|
width: 55px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
flex: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 关闭按钮样式 */
|
||||||
|
.close-btn {
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
right: 10px;
|
||||||
|
width: 14px;
|
||||||
|
color: white;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.indicator {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table th,
|
||||||
|
.table td {
|
||||||
|
border: 1px solid #000;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
244
src/views/pqs/cockpit/realTimeData/index.vue
Normal file
@@ -0,0 +1,244 @@
|
|||||||
|
<template>
|
||||||
|
<div class="default-main" :style="{ padding: prop.height ? '0px !important' : '10px' }">
|
||||||
|
<!-- 实时数据 -->
|
||||||
|
<!-- 添加加载事件监听 -->
|
||||||
|
<div class="dataBox" :style="{ height: prop.height || pageHeight.height }" >
|
||||||
|
<div
|
||||||
|
class="iframe-container"
|
||||||
|
:style="{
|
||||||
|
boxShadow: `var(--el-box-shadow-light)`
|
||||||
|
}"
|
||||||
|
style="position: relative;"
|
||||||
|
>
|
||||||
|
<iframe
|
||||||
|
:src="iframeSrc"
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
frameborder="0"
|
||||||
|
scrolling="no"
|
||||||
|
id="iframeLeft"
|
||||||
|
@load="onIframeLoad"
|
||||||
|
></iframe>
|
||||||
|
<IframeDia
|
||||||
|
style="position: absolute; top: 0px; right: 0px; left: 0px"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-card class="bottom-container " style="min-height: 230px;">
|
||||||
|
<div class="buttonBox">
|
||||||
|
<el-button type="primary" icon="el-icon-Aim">复位</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="tableBox">
|
||||||
|
<Table ref="tableRef" height="100%"></Table>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, watch, onMounted, onUnmounted, provide } from 'vue'
|
||||||
|
import Table from '@/components/table/index.vue'
|
||||||
|
import TableStore from '@/utils/tableStore'
|
||||||
|
import { mainHeight } from '@/utils/layout'
|
||||||
|
import IframeDia from './iframeDia.vue'
|
||||||
|
// import { getActive } from "@/api/manage_wx/index";
|
||||||
|
|
||||||
|
// const props = defineProps<{
|
||||||
|
// project: { id: string; name: string } | null
|
||||||
|
// }>()
|
||||||
|
|
||||||
|
const prop = defineProps({
|
||||||
|
width: { type: [String, Number]},
|
||||||
|
height: { type: [String, Number]},
|
||||||
|
timeKey: { type: [String, Number]},
|
||||||
|
timeValue: { type: Object }
|
||||||
|
})
|
||||||
|
|
||||||
|
const tableStore: any = new TableStore({
|
||||||
|
url: '/user-boot/role/selectRoleDetail?id=0',
|
||||||
|
method: 'POST',
|
||||||
|
|
||||||
|
showPage: false,
|
||||||
|
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
field: 'index',
|
||||||
|
title: '序号',
|
||||||
|
width: '80',
|
||||||
|
formatter: (row: any) => {
|
||||||
|
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '时间',
|
||||||
|
field: 'whetherToGovern',
|
||||||
|
minWidth: '70'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '监测点名',
|
||||||
|
field: 'name',
|
||||||
|
minWidth: '90'
|
||||||
|
|
||||||
|
// render: 'customTemplate',
|
||||||
|
// customTemplate: (row: any) => {
|
||||||
|
// return `<span style='cursor: pointer;text-decoration: underline;'>${row.name}</span>`
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
|
||||||
|
{ title: '事件描述', field: 'question', minWidth: '200' }
|
||||||
|
],
|
||||||
|
beforeSearchFun: () => {
|
||||||
|
// tableStore.table.params.searchBeginTime = prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
|
||||||
|
// tableStore.table.params.searchEndTime = prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
|
||||||
|
},
|
||||||
|
loadCallback: () => {
|
||||||
|
tableStore.table.data = [
|
||||||
|
{
|
||||||
|
name: '10kV1#电动机',
|
||||||
|
type: '电动机',
|
||||||
|
whetherToGovern: '2025-01-01 15:00:00',
|
||||||
|
question: '3次谐波电压、5次谐波电流、电压不平衡度超标'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '10kV2#(治理后)',
|
||||||
|
type: '电焊机',
|
||||||
|
whetherToGovern: '2025-05-01 16:00:00',
|
||||||
|
question: '所有指标均合格'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '380V电焊机(治理前)',
|
||||||
|
type: '电焊机',
|
||||||
|
whetherToGovern: '2025-06-01 15:00:00',
|
||||||
|
question: '5次谐波电流、电压不平衡度超标'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '380V水泵机',
|
||||||
|
type: '电动机',
|
||||||
|
whetherToGovern: '2025-08-01 15:00:00',
|
||||||
|
question: '所有指标均合格'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const tableRef = ref()
|
||||||
|
provide('tableRef', tableRef)
|
||||||
|
const pageHeight = mainHeight(40)
|
||||||
|
provide('tableStore', tableStore)
|
||||||
|
|
||||||
|
const iframeSrc = ref('')
|
||||||
|
|
||||||
|
// 监听 props 变化
|
||||||
|
// watch(
|
||||||
|
// () => props.project,
|
||||||
|
// newVal => {
|
||||||
|
// if (newVal && newVal.id && newVal.name) {
|
||||||
|
// // window.location.origin
|
||||||
|
// // iframeSrc.value =
|
||||||
|
// // "http://192.168.1.179:4001" +
|
||||||
|
// // `/zutai/?id=${newVal.id}&&name=${encodeURIComponent(
|
||||||
|
// // newVal.name
|
||||||
|
// // )}&&preview=true&&display=true&&graphicDisplay=wx#/preview`;
|
||||||
|
// iframeSrc.value =
|
||||||
|
// 'http://192.168.1.179:4001' +
|
||||||
|
// `/zutai/?id=4b4f7f4260198776594f5f9d93a532e8&&name=stt&&preview=true&&display=true#/preview_YPT`
|
||||||
|
|
||||||
|
// // console.log("更新 iframeSrc:", iframeSrc.value);
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// { immediate: true, deep: true }
|
||||||
|
// )
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
iframeSrc.value =
|
||||||
|
'http://192.168.1.179:4001' +
|
||||||
|
`/zutai/?id=4b4f7f4260198776594f5f9d93a532e8&&name=stt&&preview=true#/preview_YPT`
|
||||||
|
|
||||||
|
tableStore.index()
|
||||||
|
|
||||||
|
// 监听来自 eventStatistics 组件的消息
|
||||||
|
window.addEventListener('message', handleMessage)
|
||||||
|
|
||||||
|
// getActive({}).then((res: any) => {
|
||||||
|
// if (res.code == "A0000") {
|
||||||
|
// // window.location.origin
|
||||||
|
// iframeSrc.value =
|
||||||
|
// "http://192.168.1.179:4001" +
|
||||||
|
// `/zutai/?id=${res.data.id}&&name=${encodeURIComponent(
|
||||||
|
// res.data.name
|
||||||
|
// )}&&preview=true&&display=true&&graphicDisplay=wx#/preview`;
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
// 清理事件监听器
|
||||||
|
window.removeEventListener('message', handleMessage)
|
||||||
|
})
|
||||||
|
|
||||||
|
// iframe 加载完成回调 添加加载事件监听
|
||||||
|
const onIframeLoad = () => {
|
||||||
|
// console.log("iframe 加载完成");
|
||||||
|
// 通知 securityDetail.vue 组件 iframe 已加载完成
|
||||||
|
window.postMessage(
|
||||||
|
{
|
||||||
|
type: 'IFRAME_LOADED',
|
||||||
|
data: { loaded: true }
|
||||||
|
},
|
||||||
|
'*'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理来自 eventStatistics 组件的消息
|
||||||
|
const handleMessage = (event: MessageEvent) => {
|
||||||
|
// 验证消息来源(在生产环境中应该验证 origin)
|
||||||
|
// if (event.origin !== 'trusted-origin') return;
|
||||||
|
|
||||||
|
const { type, payload } = event.data
|
||||||
|
|
||||||
|
if (type === 'SEND_KEYS_TO_IFRAME') {
|
||||||
|
// 将数据转发给 iframe
|
||||||
|
sendKeysToIframe(payload)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 向 iframe 发送 keyList 数据
|
||||||
|
const sendKeysToIframe = (keyList: string[]) => {
|
||||||
|
const iframe = document.getElementById('iframeLeft') as HTMLIFrameElement
|
||||||
|
if (iframe && iframe.contentWindow) {
|
||||||
|
iframe.contentWindow.postMessage(
|
||||||
|
{
|
||||||
|
type: 'ANALYSIS_KEYS',
|
||||||
|
payload: keyList
|
||||||
|
},
|
||||||
|
'*'
|
||||||
|
) // 在生产环境中应该指定具体的域名而不是 '*'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.dataBox {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.iframe-container {
|
||||||
|
flex: 3.5;
|
||||||
|
}
|
||||||
|
:deep(.el-card__body) {
|
||||||
|
display: flex;
|
||||||
|
padding: 10px;
|
||||||
|
height: 100%;
|
||||||
|
.buttonBox {
|
||||||
|
display: flex;
|
||||||
|
width: 150px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.tableBox {
|
||||||
|
flex: 1;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,29 +1,29 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="pd10">
|
<div class="pd10">
|
||||||
<el-card>
|
<el-card>
|
||||||
<el-form ref="formRef" inline :rules="rules" :model="form" label-width="120px" class="form-four">
|
<el-form ref="formRef" inline :rules="rules" :model="form" label-width="auto" class="form-four">
|
||||||
<el-form-item label="页面名称:" prop="pageName">
|
<el-form-item label="页面名称" prop="pageName">
|
||||||
<el-input
|
<el-input
|
||||||
|
style="width: 100%"
|
||||||
maxlength="32"
|
maxlength="32"
|
||||||
show-word-limit
|
show-word-limit
|
||||||
v-model.trim="form.pageName"
|
v-model.trim="form.pageName"
|
||||||
placeholder="请输入页面名称"
|
placeholder="请输入页面名称"
|
||||||
></el-input>
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="图标">
|
||||||
<el-form-item label="页面排序:" prop="sort">
|
<IconSelector v-model.trim="form.icon" style="width: 80%" placeholder="请选择图标" />
|
||||||
<el-input
|
|
||||||
maxlength="32"
|
|
||||||
show-word-limit-number
|
|
||||||
v-model.trim.number="form.sort"
|
|
||||||
:min="0"
|
|
||||||
:step="1"
|
|
||||||
step-strictly
|
|
||||||
style="width: 100%"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="页面排序" prop="sort">
|
||||||
|
<el-input-number style="width: 100%" v-model.trim="form.sort" :min="0" :max="10000" :step="1" />
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="绑定页面">
|
||||||
|
<el-select v-model="form.pagePath" filterable placeholder="请选择绑定页面" style="width: 100%" clearable>
|
||||||
|
<el-option v-for="item in pageList" :key="item.path" :label="item.name" :value="item.path" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item> -->
|
||||||
|
|
||||||
<el-form-item label="备注:" class="top">
|
<el-form-item label="备注" class="top">
|
||||||
<el-input
|
<el-input
|
||||||
maxlength="300"
|
maxlength="300"
|
||||||
show-word-limit
|
show-word-limit
|
||||||
@@ -87,6 +87,7 @@
|
|||||||
<template #item="{ item }">
|
<template #item="{ item }">
|
||||||
<div class="imgBox">
|
<div class="imgBox">
|
||||||
<div class="textName">{{ item.name }}</div>
|
<div class="textName">{{ item.name }}</div>
|
||||||
|
|
||||||
<img
|
<img
|
||||||
:src="getImg(item.path)"
|
:src="getImg(item.path)"
|
||||||
:style="{
|
:style="{
|
||||||
@@ -106,6 +107,7 @@
|
|||||||
'px'
|
'px'
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<CloseBold class="remove" @click="removeItem(item.i)" />
|
<CloseBold class="remove" @click="removeItem(item.i)" />
|
||||||
</div>
|
</div>
|
||||||
<!-- <span class="text">{{ `${item?.name}` }}</span>
|
<!-- <span class="text">{{ `${item?.name}` }}</span>
|
||||||
@@ -118,11 +120,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref, reactive, onMounted, onBeforeUnmount } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import BackComponent from '@/components/icon/back/index.vue'
|
import BackComponent from '@/components/icon/back/index.vue'
|
||||||
import { mainHeight } from '@/utils/layout'
|
import { mainHeight } from '@/utils/layout'
|
||||||
import type { CollapseIconPositionType } from 'element-plus'
|
import type { CollapseIconPositionType } from 'element-plus'
|
||||||
|
import IconSelector from '@/components/baInput/components/iconSelector.vue'
|
||||||
import { componentTree } from '@/api/user-boot/user'
|
import { componentTree } from '@/api/user-boot/user'
|
||||||
import { GridLayout, GridItem } from 'grid-layout-plus'
|
import { GridLayout, GridItem } from 'grid-layout-plus'
|
||||||
import { throttle } from 'lodash-es'
|
import { throttle } from 'lodash-es'
|
||||||
@@ -130,11 +133,18 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
|||||||
import { Tools, CloseBold } from '@element-plus/icons-vue'
|
import { Tools, CloseBold } from '@element-plus/icons-vue'
|
||||||
import { addDashboard, updateDashboard, queryById } from '@/api/system-boot/csstatisticalset'
|
import { addDashboard, updateDashboard, queryById } from '@/api/system-boot/csstatisticalset'
|
||||||
import html2canvas from 'html2canvas'
|
import html2canvas from 'html2canvas'
|
||||||
|
import { useRoute } from 'vue-router'
|
||||||
|
import { getMenu } from '@/utils/router'
|
||||||
|
// defineOptions({
|
||||||
|
// name: 'cockpit/popup'
|
||||||
|
// })
|
||||||
const { go } = useRouter()
|
const { go } = useRouter()
|
||||||
const { query } = useRoute()
|
const { query } = useRoute()
|
||||||
|
const router = useRouter()
|
||||||
const height = mainHeight(108)
|
const height = mainHeight(108)
|
||||||
const indicatorHeight = mainHeight(128)
|
const indicatorHeight = mainHeight(128)
|
||||||
const rowHeight = ref(0)
|
const rowHeight = ref(0)
|
||||||
|
const pageList: any = ref([])
|
||||||
const GridHeight = ref(0)
|
const GridHeight = ref(0)
|
||||||
const position = ref<CollapseIconPositionType>('left')
|
const position = ref<CollapseIconPositionType>('left')
|
||||||
const form: any = reactive({
|
const form: any = reactive({
|
||||||
@@ -143,7 +153,11 @@ const form: any = reactive({
|
|||||||
containerConfig: [],
|
containerConfig: [],
|
||||||
sort: '100',
|
sort: '100',
|
||||||
id: '',
|
id: '',
|
||||||
remark: ''
|
|
||||||
|
icon: '',
|
||||||
|
pagePath: '',
|
||||||
|
remark: '',
|
||||||
|
routeName: '/src/views/pqs/cockpit/homePage/index.vue'
|
||||||
})
|
})
|
||||||
const activeNames = ref([])
|
const activeNames = ref([])
|
||||||
const activeNames1 = ref([])
|
const activeNames1 = ref([])
|
||||||
@@ -167,6 +181,13 @@ const layout: any = ref([
|
|||||||
const treeComponents: any = ref([]) //组件树
|
const treeComponents: any = ref([]) //组件树
|
||||||
const treeComponentsCopy: any = ref([]) //组件树
|
const treeComponentsCopy: any = ref([]) //组件树
|
||||||
const info = () => {
|
const info = () => {
|
||||||
|
pageList.value = router
|
||||||
|
.getRoutes()
|
||||||
|
.filter(item => item?.meta?.component == '/src/views/pqs/cockpit/homePage/index.vue')
|
||||||
|
.map(item => {
|
||||||
|
return { name: item?.meta?.title, path: item?.meta?.path }
|
||||||
|
})
|
||||||
|
|
||||||
activeNames.value = []
|
activeNames.value = []
|
||||||
activeNames1.value = []
|
activeNames1.value = []
|
||||||
componentTree().then(res => {
|
componentTree().then(res => {
|
||||||
@@ -184,10 +205,14 @@ const info = () => {
|
|||||||
queryById({ id: query.id }).then(res => {
|
queryById({ id: query.id }).then(res => {
|
||||||
layout.value = JSON.parse(res.data.containerConfig)
|
layout.value = JSON.parse(res.data.containerConfig)
|
||||||
form.pageName = res.data.pageName
|
form.pageName = res.data.pageName
|
||||||
|
form.pagePath = query.path || res.data.pagePath
|
||||||
form.sort = res.data.sort
|
form.sort = res.data.sort
|
||||||
form.remark = res.data.remark
|
form.remark = res.data.remark
|
||||||
form.id = res.data.id
|
form.id = res.data.id
|
||||||
|
form.icon = res.data.icon
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
form.pagePath = query.path
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,7 +311,6 @@ const drag = throttle(row => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
function dragEnd(row: any) {
|
function dragEnd(row: any) {
|
||||||
console.log('🚀 ~ drag ~ row:', row)
|
|
||||||
const parentRect = wrapper.value?.getBoundingClientRect()
|
const parentRect = wrapper.value?.getBoundingClientRect()
|
||||||
|
|
||||||
if (!parentRect || !gridLayout.value) return
|
if (!parentRect || !gridLayout.value) return
|
||||||
@@ -309,7 +333,7 @@ function dragEnd(row: any) {
|
|||||||
y: dragItem.y,
|
y: dragItem.y,
|
||||||
w: dragItem.w,
|
w: dragItem.w,
|
||||||
h: dragItem.h,
|
h: dragItem.h,
|
||||||
i: dragItem.i,
|
i: Math.random(), //dragItem.i,
|
||||||
name: row.name,
|
name: row.name,
|
||||||
path: row.path,
|
path: row.path,
|
||||||
icon: row.icon,
|
icon: row.icon,
|
||||||
@@ -327,18 +351,19 @@ const onSubmit = () => {
|
|||||||
if (layout.value.length == 0) {
|
if (layout.value.length == 0) {
|
||||||
return ElMessage.warning('页面设计不能为空!')
|
return ElMessage.warning('页面设计不能为空!')
|
||||||
}
|
}
|
||||||
const maxValue = Math.max(...layout.value.map(item => item.y + item.h))
|
// const maxValue = Math.max(...layout.value.map(item => item.y + item.h))
|
||||||
if (maxValue > 6) {
|
// if (maxValue > 6) {
|
||||||
return ElMessage.warning('组件不能超出当前容器!')
|
// return ElMessage.warning('组件不能超出当前容器!')
|
||||||
}
|
// }
|
||||||
|
|
||||||
formRef.value.validate(async (valid: boolean) => {
|
formRef.value.validate(async (valid: boolean) => {
|
||||||
let url = ''
|
let url = ''
|
||||||
await html2canvas(document.querySelector('.GridLayout'), {
|
// await html2canvas(document.querySelector('.GridLayout'), {
|
||||||
useCORS: true
|
// useCORS: true
|
||||||
}).then(canvas => {
|
// }).then(canvas => {
|
||||||
url = canvas.toDataURL('image/png')
|
// url = canvas.toDataURL('image/png')
|
||||||
})
|
// })
|
||||||
|
form.pagePath = form.pagePath || ''
|
||||||
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (form.id == '') {
|
if (form.id == '') {
|
||||||
@@ -346,6 +371,7 @@ const onSubmit = () => {
|
|||||||
(res: any) => {
|
(res: any) => {
|
||||||
ElMessage.success('新增页面成功!')
|
ElMessage.success('新增页面成功!')
|
||||||
go(-1)
|
go(-1)
|
||||||
|
getMenu()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
@@ -353,6 +379,7 @@ const onSubmit = () => {
|
|||||||
(res: any) => {
|
(res: any) => {
|
||||||
ElMessage.success('修改页面成功!')
|
ElMessage.success('修改页面成功!')
|
||||||
go(-1)
|
go(-1)
|
||||||
|
getMenu()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -362,6 +389,7 @@ const onSubmit = () => {
|
|||||||
const getImg = throttle((path: string) => {
|
const getImg = throttle((path: string) => {
|
||||||
if (path != undefined) return treeComponentsCopy.value.filter(item => item.path == path)[0]?.image
|
if (path != undefined) return treeComponentsCopy.value.filter(item => item.path == path)[0]?.image
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
info()
|
info()
|
||||||
|
|
||||||
@@ -436,7 +464,9 @@ onBeforeUnmount(() => {
|
|||||||
.vgl-layout {
|
.vgl-layout {
|
||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
}
|
}
|
||||||
|
:deep(.el-input-group) {
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
.remove {
|
.remove {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 5px;
|
top: 5px;
|
||||||
@@ -462,4 +492,7 @@ onBeforeUnmount(() => {
|
|||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
}
|
}
|
||||||
|
:deep(.el-form--inline .el-form-item) {
|
||||||
|
margin-right: 0px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,265 +1,295 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="default-main">
|
<div class="default-main">
|
||||||
<div class=" layoutHeader">
|
<!-- <div class=" layoutHeader">
|
||||||
<div class="title">{{title}}</div>
|
<div class="title">{{title}}</div>
|
||||||
<back-component />
|
<back-component />
|
||||||
</div>
|
</div> -->
|
||||||
<GridLayout
|
<TableHeader :showSearch="false">
|
||||||
v-model:layout="layout"
|
<template v-slot:select>
|
||||||
:row-height="rowHeight"
|
<el-form-item label="统计时间">
|
||||||
:is-resizable="false"
|
<DatePicker ref="datePickerRef" :nextFlag="false" :theCurrentTime="true"></DatePicker>
|
||||||
:is-draggable="false"
|
</el-form-item>
|
||||||
:responsive="false"
|
</template>
|
||||||
:vertical-compact="false"
|
<template v-slot:operation>
|
||||||
prevent-collision
|
<back-component />
|
||||||
:col-num="12"
|
</template>
|
||||||
>
|
</TableHeader>
|
||||||
<template #item="{ item }">
|
<GridLayout
|
||||||
<div class="box">
|
v-model:layout="layout"
|
||||||
<div class="title">
|
:row-height="rowHeight"
|
||||||
<div style="display: flex; align-items: center">
|
:is-resizable="false"
|
||||||
<Icon class="HelpFilled" :name="item.icon" />
|
:is-draggable="false"
|
||||||
{{ item.name }}
|
:responsive="false"
|
||||||
</div>
|
:vertical-compact="false"
|
||||||
<!-- <FullScreen class="HelpFilled" style="cursor: pointer" @click="zoom(item)" /> -->
|
prevent-collision
|
||||||
<img :src="flag ? img : img1" style="cursor: pointer; height: 16px" @click="zoom(item)" />
|
:col-num="12"
|
||||||
</div>
|
>
|
||||||
<div>
|
<template #item="{ item }">
|
||||||
<component
|
<div class="box">
|
||||||
:is="item.component"
|
<div class="title">
|
||||||
v-if="item.component"
|
<div style="display: flex; align-items: center">
|
||||||
class="pd10"
|
<Icon class="HelpFilled" :name="item.icon" />
|
||||||
:key="key"
|
{{ item.name }}
|
||||||
:height="rowHeight * item.h - (item.h == 6 ? -20 : item.h == 2 ? 20 : 5) + 'px'"
|
</div>
|
||||||
:width="rowWidth * item.w - 5 + 'px'"
|
<!-- <FullScreen class="HelpFilled" style="cursor: pointer" @click="zoom(item)" /> -->
|
||||||
:timeKey="item.timeKey"
|
<img :src="flag ? img : img1" style="cursor: pointer; height: 16px" @click="zoom(item)" />
|
||||||
/>
|
</div>
|
||||||
<div v-else class="pd10">组件加载失败...</div>
|
<div>
|
||||||
</div>
|
<component
|
||||||
</div>
|
:is="item.component"
|
||||||
</template>
|
v-if="item.component"
|
||||||
</GridLayout>
|
class="pd10"
|
||||||
</div>
|
:key="key"
|
||||||
</template>
|
:timeValue="datePickerRef.timeValue"
|
||||||
|
:height="rowHeight * item.h - seRowHeight(item.h) + 'px'"
|
||||||
<script setup lang="ts">
|
:width="rowWidth * item.w - 30 + 'px'"
|
||||||
import { ref, reactive, onMounted, markRaw, onUnmounted, defineAsyncComponent, type Component } from 'vue'
|
:timeKey="item.timeKey"
|
||||||
import { GridLayout } from 'grid-layout-plus'
|
/>
|
||||||
import { useDebounceFn } from '@vueuse/core'
|
<div v-else class="pd10">组件加载失败...</div>
|
||||||
import { useRouter } from 'vue-router'
|
</div>
|
||||||
import BackComponent from '@/components/icon/back/index.vue'
|
</div>
|
||||||
import { queryById } from '@/api/system-boot/csstatisticalset'
|
</template>
|
||||||
import { HelpFilled, FullScreen } from '@element-plus/icons-vue'
|
</GridLayout>
|
||||||
// defineOptions({
|
</div>
|
||||||
// name: 'cockpit/homePage'
|
</template>
|
||||||
// })
|
|
||||||
const { query } = useRoute()
|
<script setup lang="ts">
|
||||||
// 定义类型
|
import { ref, reactive, onMounted, markRaw, onUnmounted, defineAsyncComponent, type Component } from 'vue'
|
||||||
interface LayoutItem {
|
import { GridLayout } from 'grid-layout-plus'
|
||||||
x: number
|
import { useDebounceFn } from '@vueuse/core'
|
||||||
y: number
|
import { useRouter } from 'vue-router'
|
||||||
w: number
|
import TableHeader from '@/components/table/header/index.vue'
|
||||||
h: number
|
import DatePicker from '@/components/form/datePicker/index.vue'
|
||||||
i: string | number
|
import BackComponent from '@/components/icon/back/index.vue'
|
||||||
name: string
|
import { queryById } from '@/api/system-boot/csstatisticalset'
|
||||||
path: string
|
import { HelpFilled, FullScreen } from '@element-plus/icons-vue'
|
||||||
component?: Component | string
|
import { useRoute } from 'vue-router'
|
||||||
loading?: boolean
|
// defineOptions({
|
||||||
error?: any
|
// name: 'cockpit/view'
|
||||||
}
|
// })
|
||||||
const title = ref('')
|
const { query } = useRoute()
|
||||||
const key = ref(0)
|
// 定义类型
|
||||||
const img = new URL(`@/assets/imgs/amplify.png`, import.meta.url)
|
interface LayoutItem {
|
||||||
const img1 = new URL(`@/assets/imgs/reduce.png`, import.meta.url)
|
x: number
|
||||||
// 响应式数据
|
y: number
|
||||||
const rowHeight = ref(0)
|
w: number
|
||||||
const rowWidth = ref(0)
|
h: number
|
||||||
const layout = ref<LayoutItem[]>([
|
i: string | number
|
||||||
// {
|
name: string
|
||||||
// x: 4,
|
path: string
|
||||||
// y: 0,
|
component?: Component | string
|
||||||
// w: 4,
|
loading?: boolean
|
||||||
// h: 2,
|
error?: any
|
||||||
// i: '1',
|
}
|
||||||
// name: '',
|
const datePickerRef = ref()
|
||||||
// path: '/src/views/pqs/runManage/assessment/components/uese/index.vue'
|
const title = ref('')
|
||||||
// },
|
const key = ref(0)
|
||||||
])
|
const img = new URL(`@/assets/img/amplify.png`, import.meta.url)
|
||||||
const layoutCopy = ref<LayoutItem[]>([])
|
const img1 = new URL(`@/assets/img/reduce.png`, import.meta.url)
|
||||||
const flag = ref(true)
|
// 响应式数据
|
||||||
// 组件映射
|
const rowHeight = ref(0)
|
||||||
const componentMap = reactive(new Map<string, Component | string>())
|
const rowWidth = ref(0)
|
||||||
|
const layout: any = ref<LayoutItem[]>([
|
||||||
// 获取主内容区域高度
|
// {
|
||||||
const getMainHeight = () => {
|
// x: 4,
|
||||||
const elMain = document.querySelector('.el-main')
|
// y: 0,
|
||||||
return (elMain?.offsetHeight || 0) - 70
|
// w: 4,
|
||||||
}
|
// h: 2,
|
||||||
// 获取主内容区域高度
|
// i: '1',
|
||||||
const getMainWidth = () => {
|
// name: '',
|
||||||
const elMain = document.querySelector('.el-main')
|
// path: '/src/views/pqs/runManage/assessment/components/uese/index.vue'
|
||||||
return (elMain?.offsetWidth || 0) - 20
|
// },
|
||||||
}
|
])
|
||||||
|
const layoutCopy = ref<LayoutItem[]>([])
|
||||||
// 初始化行高
|
const flag = ref(true)
|
||||||
const initRowHeight = () => {
|
// 组件映射
|
||||||
rowHeight.value = Math.max(0, (getMainHeight() - 72) / 6)
|
const componentMap = reactive(new Map<string, Component | string>())
|
||||||
rowWidth.value = Math.max(0, getMainWidth() / 12)
|
|
||||||
}
|
// 获取主内容区域高度
|
||||||
|
const getMainHeight = () => {
|
||||||
// 动态注册组件
|
const elMain = document.querySelector('.el-main')
|
||||||
const registerComponent = (path: string): Component | string | null => {
|
return (elMain?.offsetHeight || 0) - 70
|
||||||
if (!path) return null
|
}
|
||||||
|
// 获取主内容区域高度
|
||||||
const cacheKey = path
|
const getMainWidth = () => {
|
||||||
|
const elMain = document.querySelector('.el-main')
|
||||||
// 使用缓存的组件
|
return (elMain?.offsetWidth || 0) - 20
|
||||||
if (componentMap.has(cacheKey)) {
|
}
|
||||||
return componentMap.get(cacheKey)!
|
|
||||||
}
|
// 初始化行高
|
||||||
|
const initRowHeight = () => {
|
||||||
try {
|
rowHeight.value = Math.max(0, (getMainHeight() - 72) / 6)
|
||||||
// 动态导入组件
|
rowWidth.value = Math.max(0, getMainWidth() / 12)
|
||||||
const modules = import.meta.glob('@/views/**/*.vue')
|
}
|
||||||
if (!modules[path]) {
|
|
||||||
console.error(`组件加载失败: ${path}`)
|
// 动态注册组件
|
||||||
return null
|
const registerComponent = (path: string): Component | string | null => {
|
||||||
}
|
if (!path) return null
|
||||||
|
|
||||||
const AsyncComponent = defineAsyncComponent({
|
const cacheKey = path
|
||||||
loader: modules[path],
|
|
||||||
loadingComponent: () => h('div', '加载中...'),
|
// 使用缓存的组件
|
||||||
errorComponent: ({ error }) => h('div', `加载错误: ${error.message}`),
|
if (componentMap.has(cacheKey)) {
|
||||||
delay: 200,
|
return componentMap.get(cacheKey)!
|
||||||
timeout: 10000
|
}
|
||||||
})
|
|
||||||
|
try {
|
||||||
// 保存到映射中
|
// 动态导入组件
|
||||||
componentMap.set(cacheKey, markRaw(AsyncComponent))
|
const modules = import.meta.glob('@/**/*.vue')
|
||||||
return AsyncComponent
|
if (!modules[path]) {
|
||||||
} catch (error) {
|
console.error(`组件加载失败: ${path}`)
|
||||||
console.error('注册组件失败:', error)
|
return null
|
||||||
return null
|
}
|
||||||
}
|
|
||||||
}
|
const AsyncComponent = defineAsyncComponent({
|
||||||
// 缩放
|
loader: modules[path],
|
||||||
const zoom = (value: any) => {
|
loadingComponent: () => h('div', '加载中...'),
|
||||||
if (flag.value) {
|
errorComponent: ({ error }) => h('div', `加载错误: ${error.message}`),
|
||||||
layout.value = [{ ...value, x: 0, y: 0, w: 12, h: 6 }]
|
delay: 200,
|
||||||
} else {
|
timeout: 10000
|
||||||
layout.value = layoutCopy.value.map((item, index) => ({
|
})
|
||||||
...item,
|
|
||||||
i: item.i || index, // 确保有唯一标识
|
// 保存到映射中
|
||||||
component: registerComponent(item.path)
|
componentMap.set(cacheKey, markRaw(AsyncComponent))
|
||||||
}))
|
return AsyncComponent
|
||||||
}
|
} catch (error) {
|
||||||
flag.value = !flag.value
|
console.error('注册组件失败:', error)
|
||||||
key.value += 1
|
return null
|
||||||
}
|
}
|
||||||
// 获取布局数据
|
}
|
||||||
const fetchLayoutData = async () => {
|
// 缩放
|
||||||
try {
|
const zoom = (value: any) => {
|
||||||
const { data } = await queryById({ id: query.id })
|
if (flag.value) {
|
||||||
title.value = data.pageName+'_预览'
|
layout.value = [{ ...value, x: 0, y: 0, w: 12, h: 6 }]
|
||||||
const parsedLayout = JSON.parse(data.containerConfig || '[]') as LayoutItem[]
|
} else {
|
||||||
// 处理布局数据
|
layout.value = layoutCopy.value.map((item, index) => ({
|
||||||
layout.value = parsedLayout.map((item, index) => ({
|
...item,
|
||||||
...item,
|
i: item.i || index, // 确保有唯一标识
|
||||||
i: item.i || index, // 确保有唯一标识
|
component: registerComponent(item.path)
|
||||||
component: registerComponent(item.path)
|
}))
|
||||||
}))
|
}
|
||||||
layoutCopy.value = JSON.parse(JSON.stringify(layout.value))
|
flag.value = !flag.value
|
||||||
} catch (error) {
|
key.value += 1
|
||||||
console.error('获取布局数据失败:', error)
|
}
|
||||||
// 可以添加错误提示逻辑
|
// 获取布局数据
|
||||||
}
|
const fetchLayoutData = async () => {
|
||||||
}
|
try {
|
||||||
|
const { data } = await queryById({ id: query.id })
|
||||||
// 窗口大小变化处理 - 使用防抖
|
title.value = data.pageName + '_预览'
|
||||||
const handleResize = useDebounceFn(() => {
|
const parsedLayout = JSON.parse(data.containerConfig || '[]') as LayoutItem[]
|
||||||
initRowHeight()
|
// 处理布局数据
|
||||||
key.value += 1
|
layout.value = parsedLayout.map((item, index) => ({
|
||||||
}, 200)
|
...item,
|
||||||
|
i: item.i || index, // 确保有唯一标识
|
||||||
// 生命周期钩子
|
component: registerComponent(item.path)
|
||||||
onMounted(() => {
|
}))
|
||||||
initRowHeight()
|
layoutCopy.value = JSON.parse(JSON.stringify(layout.value))
|
||||||
fetchLayoutData()
|
} catch (error) {
|
||||||
|
console.error('获取布局数据失败:', error)
|
||||||
// 添加窗口大小变化监听器
|
// 可以添加错误提示逻辑
|
||||||
window.addEventListener('resize', handleResize)
|
}
|
||||||
})
|
}
|
||||||
|
// 计算组件高度
|
||||||
onUnmounted(() => {
|
const seRowHeight = (value: any) => {
|
||||||
// 移除监听器防止内存泄漏
|
if (value == 6) return 0
|
||||||
window.removeEventListener('resize', handleResize)
|
if (value == 5) return 12
|
||||||
})
|
if (value == 4) return 20
|
||||||
</script>
|
if (value == 3) return 30
|
||||||
|
if (value == 2) return 40
|
||||||
<style lang="scss" scoped>
|
if (value == 1) return 50
|
||||||
.vgl-layout {
|
return 0
|
||||||
background-color: #f8f9fa;
|
}
|
||||||
border-radius: 4px;
|
|
||||||
overflow: hidden;
|
// 窗口大小变化处理 - 使用防抖
|
||||||
}
|
const handleResize = useDebounceFn(() => {
|
||||||
|
initRowHeight()
|
||||||
:deep(.vgl-item:not(.vgl-item--placeholder)) {
|
key.value += 1
|
||||||
background-color: #ffffff;
|
}, 200)
|
||||||
border-radius: 4px;
|
|
||||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
|
// 生命周期钩子
|
||||||
transition: all 0.3s ease;
|
onMounted(() => {
|
||||||
}
|
initRowHeight()
|
||||||
|
fetchLayoutData()
|
||||||
:deep(.vgl-item:hover:not(.vgl-item--placeholder)) {
|
|
||||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.12);
|
// 添加窗口大小变化监听器
|
||||||
}
|
window.addEventListener('resize', handleResize)
|
||||||
|
})
|
||||||
:deep(.vgl-item--static) {
|
|
||||||
background-color: #f0f2f5;
|
onUnmounted(() => {
|
||||||
}
|
// 移除监听器防止内存泄漏
|
||||||
|
window.removeEventListener('resize', handleResize)
|
||||||
.text {
|
})
|
||||||
position: absolute;
|
</script>
|
||||||
inset: 0;
|
|
||||||
display: flex;
|
<style lang="scss" scoped>
|
||||||
align-items: center;
|
.vgl-layout {
|
||||||
justify-content: center;
|
background-color: #f8f9fa;
|
||||||
font-size: 16px;
|
border-radius: 4px;
|
||||||
color: #606266;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.vgl-item) {
|
:deep(.vgl-item:not(.vgl-item--placeholder)) {
|
||||||
overflow: hidden;
|
background-color: #ffffff;
|
||||||
}
|
border-radius: 4px;
|
||||||
.box {
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
|
||||||
overflow: hidden;
|
transition: all 0.3s ease;
|
||||||
.title {
|
}
|
||||||
border-bottom: 1px solid #000;
|
|
||||||
font-size: 14px;
|
:deep(.vgl-item:hover:not(.vgl-item--placeholder)) {
|
||||||
height: 30px;
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.12);
|
||||||
font-weight: 600;
|
}
|
||||||
padding: 0px 10px;
|
|
||||||
color: #fff;
|
:deep(.vgl-item--static) {
|
||||||
background-color: var(--el-color-primary);
|
background-color: #f0f2f5;
|
||||||
display: flex;
|
}
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
.text {
|
||||||
}
|
position: absolute;
|
||||||
.HelpFilled {
|
inset: 0;
|
||||||
height: 16px;
|
display: flex;
|
||||||
width: 16px;
|
align-items: center;
|
||||||
color: #fff !important;
|
justify-content: center;
|
||||||
margin-right: 5px;
|
font-size: 16px;
|
||||||
}
|
color: #606266;
|
||||||
}
|
}
|
||||||
.layoutHeader{
|
|
||||||
display: flex;
|
:deep(.vgl-item) {
|
||||||
justify-content: space-between;
|
overflow: hidden;
|
||||||
align-items: center;
|
}
|
||||||
padding: 10px 20px;
|
|
||||||
font-size: 16px;
|
.box {
|
||||||
.title{
|
overflow: hidden;
|
||||||
font-weight: 600;
|
|
||||||
}
|
.title {
|
||||||
}
|
border-bottom: 1px solid #000;
|
||||||
</style>
|
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>
|
||||||
|
|||||||
@@ -1,284 +1,286 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="default-main">
|
<div class="default-main">
|
||||||
<TableHeader>
|
<TableHeader>
|
||||||
<template v-slot:select>
|
<template v-slot:select>
|
||||||
<el-form-item label="页面名称">
|
<el-form-item label="页面名称">
|
||||||
<el-input
|
<el-input
|
||||||
maxlength="32"
|
maxlength="32"
|
||||||
show-word-limit
|
show-word-limit
|
||||||
v-model.trim="tableStore.table.params.searchValue"
|
v-model.trim="tableStore.table.params.searchValue"
|
||||||
placeholder="请输入页面名称"
|
placeholder="请输入页面名称"
|
||||||
></el-input>
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:operation>
|
<template v-slot:operation>
|
||||||
<el-button type="primary" @click="onSubmitadd" icon="el-icon-Plus">新增</el-button>
|
<el-button type="primary" @click="onSubmitadd" icon="el-icon-Plus">新增</el-button>
|
||||||
</template>
|
</template>
|
||||||
</TableHeader>
|
</TableHeader>
|
||||||
<!-- <Table ref="tableRef" /> -->
|
<!-- <Table ref="tableRef" /> -->
|
||||||
<div
|
<div
|
||||||
style="overflow-x: hidden; overflow-y: scroll; padding: 0 10px"
|
style="overflow-x: hidden; overflow-y: scroll; padding: 0 10px"
|
||||||
v-loading="tableStore.table.loading"
|
v-loading="tableStore.table.loading"
|
||||||
:style="{ height: tableStore.table.height }"
|
:style="{ height: tableStore.table.height }"
|
||||||
>
|
>
|
||||||
<el-row :gutter="12">
|
<el-row :gutter="12">
|
||||||
<el-col :span="6" v-for="item in tableStore.table.data" :key="item.id" class="mt10">
|
<el-col :span="6" v-for="item in tableStore.table.data" :key="item.id" class="mt10">
|
||||||
<el-card class="box-card" shadow="hover">
|
<el-card class="box-card" shadow="hover">
|
||||||
<div slot="header" class="clearfix">
|
<div slot="header" class="clearfix">
|
||||||
<span
|
<span
|
||||||
style="display: flex; align-items: center; font-weight: 550"
|
style="display: flex; align-items: center; font-weight: 550"
|
||||||
:style="{ color: item.state == 1 ? `var(--el-color-primary)` : '' }"
|
:style="{ color: item.state == 1 ? `var(--el-color-primary)` : '' }"
|
||||||
>
|
>
|
||||||
{{ item.pageName }}
|
{{ item.pageName }}
|
||||||
</span>
|
</span>
|
||||||
<div style="display: flex; justify-content: end">
|
|
||||||
<el-button
|
|
||||||
class="color"
|
<div style="display: flex; justify-content: end">
|
||||||
icon="el-icon-Position"
|
<!-- <el-button
|
||||||
style="padding: 3px 0"
|
class="color"
|
||||||
type="text"
|
icon="el-icon-Position"
|
||||||
v-if="item.state == 0"
|
style="padding: 3px 0"
|
||||||
@click="activation(item)"
|
type="text"
|
||||||
>
|
v-if="item.state == 0"
|
||||||
激活
|
@click="activation(item)"
|
||||||
</el-button>
|
>
|
||||||
<el-button
|
激活
|
||||||
class="color"
|
</el-button> -->
|
||||||
icon="el-icon-View"
|
<el-button
|
||||||
style="padding: 3px 0"
|
class="color"
|
||||||
type="text"
|
icon="el-icon-View"
|
||||||
@click="preview(item)"
|
style="padding: 3px 0"
|
||||||
>
|
type="text"
|
||||||
预览
|
@click="preview(item)"
|
||||||
</el-button>
|
>
|
||||||
<el-button
|
预览
|
||||||
class="color"
|
</el-button>
|
||||||
icon="el-icon-Edit"
|
<el-button
|
||||||
style="padding: 3px 0"
|
class="color"
|
||||||
type="text"
|
icon="el-icon-Edit"
|
||||||
@click="editd(item)"
|
style="padding: 3px 0"
|
||||||
>
|
type="text"
|
||||||
修改
|
@click="editd(item)"
|
||||||
</el-button>
|
>
|
||||||
|
修改
|
||||||
<el-button
|
</el-button>
|
||||||
icon="el-icon-Delete"
|
|
||||||
style="padding: 3px 0; color: red"
|
<el-button
|
||||||
type="text"
|
icon="el-icon-Delete"
|
||||||
@click="deleted(item)"
|
style="padding: 3px 0; color: red"
|
||||||
>
|
type="text"
|
||||||
删除
|
@click="deleted(item)"
|
||||||
</el-button>
|
>
|
||||||
</div>
|
删除
|
||||||
</div>
|
</el-button>
|
||||||
<img v-if="item.thumbnail" :src="item.thumbnail" class="image" />
|
</div>
|
||||||
<el-empty style="height: 220px" v-else description="暂无设计" />
|
</div>
|
||||||
</el-card>
|
<img v-if="item.thumbnail" :src="item.thumbnail" class="image" />
|
||||||
</el-col>
|
<el-empty style="height: 220px" v-else description="暂无设计" />
|
||||||
</el-row>
|
</el-card>
|
||||||
</div>
|
</el-col>
|
||||||
<div class="table-pagination">
|
</el-row>
|
||||||
<el-pagination
|
</div>
|
||||||
:currentPage="tableStore.table.params!.pageNum"
|
<div class="table-pagination">
|
||||||
:page-size="tableStore.table.params!.pageSize"
|
<el-pagination
|
||||||
:page-sizes="[10, 20, 50, 100]"
|
:currentPage="tableStore.table.params!.pageNum"
|
||||||
background
|
:page-size="tableStore.table.params!.pageSize"
|
||||||
:layout="'sizes,total, ->, prev, pager, next, jumper'"
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
:total="tableStore.table.total"
|
background
|
||||||
@size-change="onTableSizeChange"
|
:layout="'sizes,total, ->, prev, pager, next, jumper'"
|
||||||
@current-change="onTableCurrentChange"
|
:total="tableStore.table.total"
|
||||||
></el-pagination>
|
@size-change="onTableSizeChange"
|
||||||
</div>
|
@current-change="onTableCurrentChange"
|
||||||
</div>
|
></el-pagination>
|
||||||
</template>
|
</div>
|
||||||
<script setup lang="ts">
|
</div>
|
||||||
import { Plus } from '@element-plus/icons-vue'
|
</template>
|
||||||
import { ref, onMounted, provide } from 'vue'
|
<script setup lang="ts">
|
||||||
import TableStore from '@/utils/tableStore'
|
import { Plus } from '@element-plus/icons-vue'
|
||||||
import TableHeader from '@/components/table/header/index.vue'
|
import { ref, onMounted, provide } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import TableStore from '@/utils/tableStore'
|
||||||
import { Edit } from '@element-plus/icons-vue'
|
import TableHeader from '@/components/table/header/index.vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
const { push } = useRouter()
|
import { Edit } from '@element-plus/icons-vue'
|
||||||
import { deleteDashboard, activatePage } from '@/api/system-boot/csstatisticalset'
|
import { useRouter } from 'vue-router'
|
||||||
defineOptions({
|
const { push } = useRouter()
|
||||||
// name: 'cockpit/setUp'
|
import { deleteDashboard, activatePage } from '@/api/system-boot/csstatisticalset'
|
||||||
})
|
defineOptions({
|
||||||
const tableRef = ref()
|
// name: 'cockpit/setUp'
|
||||||
|
})
|
||||||
const tableStore = new TableStore({
|
const tableRef = ref()
|
||||||
showPage: false,
|
|
||||||
url: '/system-boot/dashboard/queryPage',
|
const tableStore = new TableStore({
|
||||||
method: 'POST',
|
showPage: false,
|
||||||
publicHeight: 60,
|
url: '/system-boot/dashboard/queryPage',
|
||||||
column: [],
|
method: 'POST',
|
||||||
loadCallback: () => {}
|
publicHeight: 60,
|
||||||
})
|
column: [],
|
||||||
provide('tableStore', tableStore)
|
loadCallback: () => {}
|
||||||
tableStore.table.params.searchValue = ''
|
})
|
||||||
onMounted(() => {
|
provide('tableStore', tableStore)
|
||||||
tableStore.table.ref = tableRef.value
|
tableStore.table.params.searchValue = ''
|
||||||
tableStore.index()
|
onMounted(() => {
|
||||||
tableStore.table.loading = false
|
tableStore.table.ref = tableRef.value
|
||||||
})
|
tableStore.index()
|
||||||
// 查询
|
tableStore.table.loading = false
|
||||||
const onSubmitadd = () => {
|
})
|
||||||
push(`/admin/cockpit/popup`)
|
// 查询
|
||||||
}
|
const onSubmitadd = () => {
|
||||||
// 预览
|
push(`/admin/cockpit/popup`)
|
||||||
const preview = (e: any) => {
|
}
|
||||||
push(`/admin/cockpit/view?id=${e.id}`)
|
// 预览
|
||||||
}
|
const preview = (e: any) => {
|
||||||
// 修改
|
push(`/admin/cockpit/view?id=${e.id}`)
|
||||||
const editd = (e: any) => {
|
}
|
||||||
push(`/admin/cockpit/popup?id=${e.id}`)
|
// 修改
|
||||||
}
|
const editd = (e: any) => {
|
||||||
// 删除
|
push(`/admin/cockpit/popup?id=${e.id}`)
|
||||||
const deleted = (e: any) => {
|
}
|
||||||
ElMessageBox.confirm('此操作将永久删除该页面, 是否继续?', '提示', {
|
// 删除
|
||||||
confirmButtonText: '确定',
|
const deleted = (e: any) => {
|
||||||
cancelButtonText: '取消',
|
ElMessageBox.confirm('此操作将永久删除该页面, 是否继续?', '提示', {
|
||||||
type: 'warning'
|
confirmButtonText: '确定',
|
||||||
})
|
cancelButtonText: '取消',
|
||||||
.then(() => {
|
type: 'warning'
|
||||||
deleteDashboard({ id: e.id }).then((res: any) => {
|
})
|
||||||
if (res.code == 'A0000') {
|
.then(() => {
|
||||||
ElMessage({
|
deleteDashboard({ id: e.id }).then((res: any) => {
|
||||||
type: 'success',
|
if (res.code == 'A0000') {
|
||||||
message: '删除页面成功!'
|
ElMessage({
|
||||||
})
|
type: 'success',
|
||||||
}
|
message: '删除页面成功!'
|
||||||
tableStore.index()
|
})
|
||||||
})
|
}
|
||||||
})
|
tableStore.index()
|
||||||
.catch(() => {
|
})
|
||||||
ElMessage({
|
})
|
||||||
type: 'info',
|
.catch(() => {
|
||||||
message: '已取消删除'
|
ElMessage({
|
||||||
})
|
type: 'info',
|
||||||
})
|
message: '已取消删除'
|
||||||
}
|
})
|
||||||
// 激活
|
})
|
||||||
const activation = (e: any) => {
|
}
|
||||||
ElMessageBox.confirm('此操作将激活该页面, 是否继续?', '提示', {
|
// 激活
|
||||||
confirmButtonText: '确定',
|
const activation = (e: any) => {
|
||||||
cancelButtonText: '取消',
|
ElMessageBox.confirm('此操作将激活该页面, 是否继续?', '提示', {
|
||||||
type: 'warning'
|
confirmButtonText: '确定',
|
||||||
})
|
cancelButtonText: '取消',
|
||||||
.then(() => {
|
type: 'warning'
|
||||||
activatePage({ id: e.id }).then((res: any) => {
|
})
|
||||||
if (res.code == 'A0000') {
|
.then(() => {
|
||||||
ElMessage({
|
activatePage({ id: e.id }).then((res: any) => {
|
||||||
type: 'success',
|
if (res.code == 'A0000') {
|
||||||
message: '激活成功!'
|
ElMessage({
|
||||||
})
|
type: 'success',
|
||||||
}
|
message: '激活成功!'
|
||||||
tableStore.index()
|
})
|
||||||
})
|
}
|
||||||
})
|
tableStore.index()
|
||||||
.catch(() => {
|
})
|
||||||
ElMessage({
|
})
|
||||||
type: 'info',
|
.catch(() => {
|
||||||
message: '已取消删除'
|
ElMessage({
|
||||||
})
|
type: 'info',
|
||||||
})
|
message: '已取消删除'
|
||||||
}
|
})
|
||||||
|
})
|
||||||
const onTableSizeChange = (val: number) => {
|
}
|
||||||
tableStore.onTableAction('page-size-change', { size: val })
|
|
||||||
}
|
const onTableSizeChange = (val: number) => {
|
||||||
|
tableStore.onTableAction('page-size-change', { size: val })
|
||||||
const onTableCurrentChange = (val: number) => {
|
}
|
||||||
tableStore.onTableAction('current-page-change', { page: val })
|
|
||||||
}
|
const onTableCurrentChange = (val: number) => {
|
||||||
</script>
|
tableStore.onTableAction('current-page-change', { page: val })
|
||||||
<style lang="scss" scoped>
|
}
|
||||||
.text {
|
</script>
|
||||||
font-size: 14px;
|
<style lang="scss" scoped>
|
||||||
}
|
.text {
|
||||||
|
font-size: 14px;
|
||||||
span {
|
}
|
||||||
font-size: 16px;
|
|
||||||
}
|
span {
|
||||||
|
font-size: 16px;
|
||||||
.item {
|
}
|
||||||
margin-bottom: 18px;
|
|
||||||
}
|
.item {
|
||||||
|
margin-bottom: 18px;
|
||||||
.image {
|
}
|
||||||
display: block;
|
|
||||||
width: 100%;
|
.image {
|
||||||
height: 220px;
|
display: block;
|
||||||
}
|
width: 100%;
|
||||||
|
height: 220px;
|
||||||
.clearfix::before,
|
}
|
||||||
.clearfix::after {
|
|
||||||
display: table;
|
.clearfix::before,
|
||||||
content: '';
|
.clearfix::after {
|
||||||
}
|
display: table;
|
||||||
|
content: '';
|
||||||
.clearfix::after {
|
}
|
||||||
clear: both;
|
|
||||||
}
|
.clearfix::after {
|
||||||
|
clear: both;
|
||||||
.box-card {
|
}
|
||||||
width: 100%;
|
|
||||||
// border: 1px solid #000;
|
.box-card {
|
||||||
box-shadow: var(--el-box-shadow-light);
|
width: 100%;
|
||||||
}
|
// border: 1px solid #000;
|
||||||
|
box-shadow: var(--el-box-shadow-light);
|
||||||
.setstyle {
|
}
|
||||||
min-height: 200px;
|
|
||||||
padding: 0 !important;
|
.setstyle {
|
||||||
margin: 0;
|
min-height: 200px;
|
||||||
overflow: auto;
|
padding: 0 !important;
|
||||||
cursor: default !important;
|
margin: 0;
|
||||||
}
|
overflow: auto;
|
||||||
|
cursor: default !important;
|
||||||
.color {
|
}
|
||||||
color: var(--el-color-primary);
|
|
||||||
}
|
.color {
|
||||||
|
color: var(--el-color-primary);
|
||||||
:deep(.el-select-dropdown__wrap) {
|
}
|
||||||
max-height: 300px;
|
|
||||||
}
|
:deep(.el-select-dropdown__wrap) {
|
||||||
|
max-height: 300px;
|
||||||
:deep(.el-tree) {
|
}
|
||||||
padding-top: 15px;
|
|
||||||
padding-left: 10px;
|
:deep(.el-tree) {
|
||||||
|
padding-top: 15px;
|
||||||
// 不可全选样式
|
padding-left: 10px;
|
||||||
.el-tree-node {
|
|
||||||
.is-leaf + .el-checkbox .el-checkbox__inner {
|
// 不可全选样式
|
||||||
display: inline-block;
|
.el-tree-node {
|
||||||
}
|
.is-leaf + .el-checkbox .el-checkbox__inner {
|
||||||
|
display: inline-block;
|
||||||
.el-checkbox .el-checkbox__inner {
|
}
|
||||||
display: none;
|
|
||||||
}
|
.el-checkbox .el-checkbox__inner {
|
||||||
}
|
display: none;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
:deep(.el-card__header) {
|
}
|
||||||
padding: 13px 20px;
|
|
||||||
height: 44px;
|
:deep(.el-card__header) {
|
||||||
}
|
padding: 13px 20px;
|
||||||
|
height: 44px;
|
||||||
.table-pagination {
|
}
|
||||||
height: 58px;
|
|
||||||
box-sizing: border-box;
|
.table-pagination {
|
||||||
width: 100%;
|
height: 58px;
|
||||||
max-width: 100%;
|
box-sizing: border-box;
|
||||||
background-color: var(--ba-bg-color-overlay);
|
width: 100%;
|
||||||
padding: 13px 15px;
|
max-width: 100%;
|
||||||
border-left: 1px solid #e4e7e9;
|
background-color: var(--ba-bg-color-overlay);
|
||||||
border-right: 1px solid #e4e7e9;
|
padding: 13px 15px;
|
||||||
border-bottom: 1px solid #e4e7e9;
|
border-left: 1px solid #e4e7e9;
|
||||||
}
|
border-right: 1px solid #e4e7e9;
|
||||||
|
border-bottom: 1px solid #e4e7e9;
|
||||||
:deep(.el-pagination__sizes) {
|
}
|
||||||
.el-select {
|
|
||||||
min-width: 128px;
|
:deep(.el-pagination__sizes) {
|
||||||
}
|
.el-select {
|
||||||
}
|
min-width: 128px;
|
||||||
</style>
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ const tableStore = new TableStore({
|
|||||||
{ title: '事件描述', field: 'describe', align: 'center', showOverflow: true,minWidth: 200 },
|
{ title: '事件描述', field: 'describe', align: 'center', showOverflow: true,minWidth: 200 },
|
||||||
{ title: '事件类型', field: 'type', align: 'center', width: 160 },
|
{ title: '事件类型', field: 'type', align: 'center', width: 160 },
|
||||||
{ title: '操作结果', field: 'type', align: 'center', width: 100 },
|
{ title: '操作结果', field: 'type', align: 'center', width: 100 },
|
||||||
{ title: '操作IP', field: 'ip', align: 'center', width: 160 },
|
{ title: '操作IP', field: 'ip', align: 'center', width: 120 },
|
||||||
{ title: '事件等级', field: 'level', align: 'center', width: 100 }
|
{ title: '事件等级', field: 'level', align: 'center', width: 100 }
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,96 +1,96 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog draggable class="cn-operate-dialog" v-model="dialogVisible" :title="title" width="700px">
|
<el-dialog draggable class="cn-operate-dialog" v-model="dialogVisible" :title="title" width="700px">
|
||||||
<el-scrollbar>
|
<el-scrollbar>
|
||||||
<el-form :inline="false" :model="form" label-width="auto" :rules="rules" ref="formRef">
|
<el-form :inline="false" :model="form" label-width="auto" :rules="rules" ref="formRef">
|
||||||
<el-form-item label="上级名称">
|
<el-form-item label="上级名称">
|
||||||
<!-- <el-input v-model="form.pid" placeholder="上级名称" /> -->
|
<!-- <el-input v-model="form.pid" placeholder="上级名称" /> -->
|
||||||
<el-tree-select
|
<el-tree-select
|
||||||
v-model="form.pid"
|
v-model="form.pid"
|
||||||
:data="dataTree"
|
:data="dataTree"
|
||||||
check-strictly
|
check-strictly
|
||||||
clearable
|
clearable
|
||||||
default-expand-all
|
default-expand-all
|
||||||
:render-after-expand="false"
|
:render-after-expand="false"
|
||||||
:props="defaultProps"
|
:props="defaultProps"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="名称" prop="name">
|
<el-form-item label="名称" prop="name">
|
||||||
<el-input v-model="form.name" placeholder="名称" />
|
<el-input v-model="form.name" placeholder="名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click="dialogVisible = false">取消</el-button>
|
<el-button @click="dialogVisible = false">取消</el-button>
|
||||||
<el-button type="primary" @click="submit">确认</el-button>
|
<el-button type="primary" @click="submit">确认</el-button>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, inject } from 'vue'
|
import { ref, inject } from 'vue'
|
||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { queryAllAlgorithmLibrary, addAlgorithm } from '@/api/supervision-boot/database/index'
|
import { queryAllAlgorithmLibrary, addAlgorithm } from '@/api/supervision-boot/database/index'
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const title = ref('')
|
const title = ref('')
|
||||||
const emit = defineEmits(['getTree'])
|
const emit = defineEmits(['getTree'])
|
||||||
const formRef = ref()
|
const formRef = ref()
|
||||||
// 注意不要和表单ref的命名冲突
|
// 注意不要和表单ref的命名冲突
|
||||||
const form = reactive<anyObj>({
|
const form = reactive<anyObj>({
|
||||||
name: '',
|
name: '',
|
||||||
pid: ''
|
pid: ''
|
||||||
})
|
})
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'name',
|
label: 'name',
|
||||||
value: 'id'
|
value: 'id'
|
||||||
}
|
}
|
||||||
const rules = {
|
const rules = {
|
||||||
name: [{ required: true, message: '请输入名称', trigger: 'blur' }]
|
name: [{ required: true, message: '请输入名称', trigger: 'blur' }]
|
||||||
}
|
}
|
||||||
const dataTree = ref([])
|
const dataTree = ref([])
|
||||||
const open = (text: string, data?: anyObj) => {
|
const open = (text: string, data?: anyObj) => {
|
||||||
getTheTree()
|
getTheTree()
|
||||||
title.value = text
|
title.value = text
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
if (data) {
|
if (data) {
|
||||||
// 表单赋值
|
// 表单赋值
|
||||||
for (let key in form) {
|
for (let key in form) {
|
||||||
form[key] = data[key]
|
form[key] = data[key]
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 在此处恢复默认表单
|
// 在此处恢复默认表单
|
||||||
for (let key in form) {
|
for (let key in form) {
|
||||||
form[key] = ''
|
form[key] = ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const getTheTree = () => {
|
const getTheTree = () => {
|
||||||
queryAllAlgorithmLibrary().then(res => {
|
queryAllAlgorithmLibrary().then(res => {
|
||||||
res.data.forEach((item: any) => {
|
res.data.forEach((item: any) => {
|
||||||
item.children.forEach((item2: any) => {
|
item.children.forEach((item2: any) => {
|
||||||
item2.childrens = item2.children
|
item2.childrens = item2.children
|
||||||
item2.children = []
|
item2.children = []
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
dataTree.value = res.data
|
dataTree.value = res.data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
formRef.value.validate(async (valid: boolean) => {
|
formRef.value.validate(async (valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
addAlgorithm({
|
addAlgorithm({
|
||||||
pid: form.pid.length == 0 ? '' : form.pid,
|
pid: form.pid.length == 0 ? '' : form.pid,
|
||||||
name: form.name
|
name: form.name
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
ElMessage.success('新增成功')
|
ElMessage.success('新增成功')
|
||||||
emit('getTree')
|
emit('getTree')
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,190 +1,190 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog draggable class="cn-operate-dialog" v-model="dialogVisible" :title="title" width="1200px">
|
<el-dialog draggable class="cn-operate-dialog" v-model="dialogVisible" :title="title" width="1200px">
|
||||||
|
|
||||||
<el-form :model="form" label-width="120px" class="form-two" :rules="rules" ref="formRef">
|
<el-form :model="form" label-width="120px" class="form-two" :rules="rules" ref="formRef">
|
||||||
<el-form-item :label="title == '修改算法' ? '选择修改的数据' : '选择父级'" :prop="title == '修改算法' ? 'pid' : ''">
|
<el-form-item :label="title == '修改算法' ? '选择修改的数据' : '选择父级'" :prop="title == '修改算法' ? 'pid' : ''">
|
||||||
<el-tree-select v-model="form.pid" :data="dataTree" check-strictly clearable filterable
|
<el-tree-select v-model="form.pid" :data="dataTree" check-strictly clearable filterable
|
||||||
@node-click="changeTree" default-expand-all :render-after-expand="false" :props="defaultProps"
|
@node-click="changeTree" default-expand-all :render-after-expand="false" :props="defaultProps"
|
||||||
@clear="TreeList = {}" />
|
@clear="TreeList = {}" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="名称" prop="name" v-if="title == '修改算法' ? TreeList.level != 4 : TreeList.level != 3">
|
<el-form-item label="名称" prop="name" v-if="title == '修改算法' ? TreeList.level != 4 : TreeList.level != 3">
|
||||||
<el-input v-model="form.name" placeholder="名称" clearable maxlength="32" show-word-limit @input="handleInput('name', $event)"/>
|
<el-input v-model="form.name" placeholder="名称" clearable maxlength="32" show-word-limit @input="handleInput('name', $event)"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <div v-if="title == '修改算法' ? TreeList.level == 4 : TreeList.level == 3"> -->
|
<!-- <div v-if="title == '修改算法' ? TreeList.level == 4 : TreeList.level == 3"> -->
|
||||||
<el-form-item label="算法名称" prop="name" v-if="title == '修改算法' ? TreeList.level == 4 : TreeList.level == 3">
|
<el-form-item label="算法名称" prop="name" v-if="title == '修改算法' ? TreeList.level == 4 : TreeList.level == 3">
|
||||||
<el-input v-model="form.name" placeholder="请输入算法名称" clearable maxlength="32" show-word-limit @input="handleInput('name', $event)"/>
|
<el-input v-model="form.name" placeholder="请输入算法名称" clearable maxlength="32" show-word-limit @input="handleInput('name', $event)"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="计算周期" prop="period" v-if="title == '修改算法' ? TreeList.level == 4 : TreeList.level == 3">
|
<el-form-item label="计算周期" prop="period" v-if="title == '修改算法' ? TreeList.level == 4 : TreeList.level == 3">
|
||||||
<el-select v-model="form.period" placeholder="请选择计算周期" clearable>
|
<el-select v-model="form.period" placeholder="请选择计算周期" clearable>
|
||||||
<el-option v-for="item in cycle" :key="item.value" :label="item.label" :value="item.value" />
|
<el-option v-for="item in cycle" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="数据来源" prop="source" v-if="title == '修改算法' ? TreeList.level == 4 : TreeList.level == 3">
|
<el-form-item label="数据来源" prop="source" v-if="title == '修改算法' ? TreeList.level == 4 : TreeList.level == 3">
|
||||||
<el-input v-model="form.source" placeholder="请输入数据来源" clearable maxlength="32" show-word-limit @input="handleInput('source', $event)"/>
|
<el-input v-model="form.source" placeholder="请输入数据来源" clearable maxlength="32" show-word-limit @input="handleInput('source', $event)"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="定义" prop="definition" style="width: 100%;" v-if="title == '修改算法' ? TreeList.level == 4 : TreeList.level == 3">
|
<!-- <el-form-item label="定义" prop="definition" style="width: 100%;" v-if="title == '修改算法' ? TreeList.level == 4 : TreeList.level == 3">
|
||||||
|
|
||||||
<editor v-model="form.definition" />
|
<editor v-model="form.definition" />
|
||||||
</el-form-item> -->
|
</el-form-item> -->
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="display: flex" v-if="title == '修改算法' ? TreeList.level == 4 : TreeList.level == 3">
|
<div style="display: flex" v-if="title == '修改算法' ? TreeList.level == 4 : TreeList.level == 3">
|
||||||
<div style="width: 140px;margin-right: -20px;text-align: center;flex-shrink: 0;">定义</div>
|
<div style="width: 140px;margin-right: -20px;text-align: center;flex-shrink: 0;">定义</div>
|
||||||
<editor v-model="form.definition" />
|
<editor v-model="form.definition" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click="dialogVisible = false">取消</el-button>
|
<el-button @click="dialogVisible = false">取消</el-button>
|
||||||
<el-button type="primary" @click="submit" v-loading="loading">确认</el-button>
|
<el-button type="primary" @click="submit" v-loading="loading">确认</el-button>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, nextTick } from 'vue'
|
import { ref, nextTick } from 'vue'
|
||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { queryAllAlgorithmLibrary, addAlgorithm, updateAlgorithmLibrary } from '@/api/supervision-boot/database/index'
|
import { queryAllAlgorithmLibrary, addAlgorithm, updateAlgorithmLibrary } from '@/api/supervision-boot/database/index'
|
||||||
import editor from '@/components/wangEditor/index.vue'
|
import editor from '@/components/wangEditor/index.vue'
|
||||||
const emit = defineEmits(['getTree'])
|
const emit = defineEmits(['getTree'])
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const title = ref('')
|
const title = ref('')
|
||||||
const formRef = ref()
|
const formRef = ref()
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const dataTree = ref([])
|
const dataTree = ref([])
|
||||||
const key = ref(0)
|
const key = ref(0)
|
||||||
const TreeList: any = ref({})
|
const TreeList: any = ref({})
|
||||||
const List = ref({})
|
const List = ref({})
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'name',
|
label: 'name',
|
||||||
value: 'id'
|
value: 'id'
|
||||||
}
|
}
|
||||||
// 注意不要和表单ref的命名冲突
|
// 注意不要和表单ref的命名冲突
|
||||||
const form = reactive<anyObj>({
|
const form = reactive<anyObj>({
|
||||||
name: '',
|
name: '',
|
||||||
period: '',
|
period: '',
|
||||||
definition: '',
|
definition: '',
|
||||||
source: '',
|
source: '',
|
||||||
pid: ''
|
pid: ''
|
||||||
})
|
})
|
||||||
const rules = {
|
const rules = {
|
||||||
name: [{ required: true, message: '请输入算法名称', trigger: 'blur' }],
|
name: [{ required: true, message: '请输入算法名称', trigger: 'blur' }],
|
||||||
period: [{ required: true, message: '请选择计算周期', trigger: 'change' }],
|
period: [{ required: true, message: '请选择计算周期', trigger: 'change' }],
|
||||||
pid: [{ required: true, message: '请选择数据', trigger: 'change' }],
|
pid: [{ required: true, message: '请选择数据', trigger: 'change' }],
|
||||||
definition: [{ required: true, message: '请输入定义', trigger: 'blur' }],
|
definition: [{ required: true, message: '请输入定义', trigger: 'blur' }],
|
||||||
source: [{ required: true, message: '请输入数据来源', trigger: 'blur' }]
|
source: [{ required: true, message: '请输入数据来源', trigger: 'blur' }]
|
||||||
}
|
}
|
||||||
const cycle = [
|
const cycle = [
|
||||||
{ value: '0', label: '日' },
|
{ value: '0', label: '日' },
|
||||||
{ value: '1', label: '月' },
|
{ value: '1', label: '月' },
|
||||||
{ value: '2', label: '季' },
|
{ value: '2', label: '季' },
|
||||||
{ value: '3', label: '年' }
|
{ value: '3', label: '年' }
|
||||||
]
|
]
|
||||||
const changeTree = (row: any) => {
|
const changeTree = (row: any) => {
|
||||||
console.log("🚀 ~ changeTree ~ row:", row)
|
console.log("🚀 ~ changeTree ~ row:", row)
|
||||||
TreeList.value = row
|
TreeList.value = row
|
||||||
if (title.value == '修改算法') {
|
if (title.value == '修改算法') {
|
||||||
if (row.level != 4) {
|
if (row.level != 4) {
|
||||||
form.name = row.name
|
form.name = row.name
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
for (let key in form) {
|
for (let key in form) {
|
||||||
form[key] = row[key]
|
form[key] = row[key]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
form.id = row.id
|
form.id = row.id
|
||||||
key.value += 1
|
key.value += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const open = (row: any) => {
|
const open = (row: any) => {
|
||||||
title.value = row.title
|
title.value = row.title
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
List.value = row.row
|
List.value = row.row
|
||||||
getTheTree()
|
getTheTree()
|
||||||
// 在此处恢复默认表单
|
// 在此处恢复默认表单
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
for (let key in form) {
|
for (let key in form) {
|
||||||
form[key] = ''
|
form[key] = ''
|
||||||
}
|
}
|
||||||
if (row.title == '修改算法') {
|
if (row.title == '修改算法') {
|
||||||
|
|
||||||
form.pid = row.row.id
|
form.pid = row.row.id
|
||||||
TreeList.value = row.row
|
TreeList.value = row.row
|
||||||
changeTree(row.row)
|
changeTree(row.row)
|
||||||
|
|
||||||
// row.row
|
// row.row
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
formRef.value.validate(async (valid: boolean) => {
|
formRef.value.validate(async (valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (title.value == '新增算法') {
|
if (title.value == '新增算法') {
|
||||||
let forms: any = {}
|
let forms: any = {}
|
||||||
if (TreeList.value.level == 3) {
|
if (TreeList.value.level == 3) {
|
||||||
forms = form
|
forms = form
|
||||||
} else {
|
} else {
|
||||||
forms.name = form.name
|
forms.name = form.name
|
||||||
forms.pid = form.pid
|
forms.pid = form.pid
|
||||||
}
|
}
|
||||||
await addAlgorithm(forms).then(res => {
|
await addAlgorithm(forms).then(res => {
|
||||||
ElMessage.success('新增成功')
|
ElMessage.success('新增成功')
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
emit('getTree')
|
emit('getTree')
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
let forms: any = {}
|
let forms: any = {}
|
||||||
if (TreeList.value.level == 4) {
|
if (TreeList.value.level == 4) {
|
||||||
forms = JSON.parse(JSON.stringify(form))
|
forms = JSON.parse(JSON.stringify(form))
|
||||||
} else {
|
} else {
|
||||||
forms.name = form.name
|
forms.name = form.name
|
||||||
forms.id = form.id
|
forms.id = form.id
|
||||||
}
|
}
|
||||||
forms.pid = null
|
forms.pid = null
|
||||||
await updateAlgorithmLibrary(forms).then(res => {
|
await updateAlgorithmLibrary(forms).then(res => {
|
||||||
ElMessage.success('修改成功')
|
ElMessage.success('修改成功')
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
emit('getTree')
|
emit('getTree')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
await setTimeout(() => {
|
await setTimeout(() => {
|
||||||
|
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
const getTheTree = () => {
|
const getTheTree = () => {
|
||||||
queryAllAlgorithmLibrary().then(res => {
|
queryAllAlgorithmLibrary().then(res => {
|
||||||
res.data.forEach((item: any) => {
|
res.data.forEach((item: any) => {
|
||||||
item.children.forEach((item2: any) => {
|
item.children.forEach((item2: any) => {
|
||||||
item2.children.forEach((item3: any) => {
|
item2.children.forEach((item3: any) => {
|
||||||
if (title.value != '修改算法') {
|
if (title.value != '修改算法') {
|
||||||
item3.childrens = item3.children
|
item3.childrens = item3.children
|
||||||
item3.children = []
|
item3.children = []
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
dataTree.value = res.data
|
dataTree.value = res.data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const handleInput = (field: string, value: string) => {
|
const handleInput = (field: string, value: string) => {
|
||||||
// 过滤空格
|
// 过滤空格
|
||||||
const filteredValue = value.replace(/\s/g, '')
|
const filteredValue = value.replace(/\s/g, '')
|
||||||
if (filteredValue !== value) {
|
if (filteredValue !== value) {
|
||||||
form[field] = filteredValue
|
form[field] = filteredValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,341 +1,59 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="default-main" :style="height">
|
<div class="default-main">
|
||||||
<!-- 算法库 -->
|
<el-tabs v-model="activeName" type="border-card">
|
||||||
<splitpanes style="height: 100%" class="default-theme" id="navigation-splitpanes">
|
<el-tab-pane label="总览" name="1" v-if="tabList.includes('1')">
|
||||||
<pane :size="size">
|
<overview v-if="activeName == '1'" @algorithm="algorithm" />
|
||||||
<algorithmTree ref="treeRef" :default-expand-all="false"
|
</el-tab-pane>
|
||||||
:default-expanded-keys="monitoringPoint.state.lineId ? [monitoringPoint.state.lineId] : []"
|
<el-tab-pane label="算法库" name="2" v-if="tabList.includes('2')">
|
||||||
:current-node-key="monitoringPoint.state.lineId" @node-click="handleNodeClick"
|
<list v-if="activeName == '2'" ref="listRef" />
|
||||||
@init="handleNodeClick" @onAddTree="onAddTree"></algorithmTree>
|
</el-tab-pane>
|
||||||
</pane>
|
</el-tabs>
|
||||||
<pane style="background: #fff" :style="height">
|
</div>
|
||||||
<div class="boxTop">
|
</template>
|
||||||
<div>
|
|
||||||
<el-radio-group v-model="radio">
|
<script setup lang="ts">
|
||||||
<el-radio-button v-for="(item, i) in dotList?.childrens" :label="item.name" :value="i" />
|
import { nextTick, ref, provide, onMounted } from 'vue'
|
||||||
</el-radio-group>
|
import { mainHeight } from '@/utils/layout'
|
||||||
</div>
|
import overview from './overview.vue'
|
||||||
<div v-if="information">
|
import list from './list.vue'
|
||||||
<el-button icon="el-icon-Plus" type="primary" @click="addUser">
|
import { useRoute } from 'vue-router'
|
||||||
新增
|
const VITE_FLAG = import.meta.env.VITE_NAME == 'jibei'
|
||||||
</el-button>
|
const route = useRoute()
|
||||||
<el-button icon="el-icon-Edit" type="primary" @click="revise">修改</el-button>
|
const Undocumented = ref()
|
||||||
<el-button icon="el-icon-Delete" type="primary" @click="deletes">删除</el-button>
|
const InterferenceUserTable = ref()
|
||||||
</div>
|
defineOptions({
|
||||||
</div>
|
name: 'supervision/interferencemanagement '
|
||||||
|
})
|
||||||
<div :style="heightTab">
|
const activeName = ref('1')
|
||||||
<vxe-table height="auto" v-bind="defaultAttribute" :data="dotList?.childrens[radio]?.children">
|
const id = ref('')
|
||||||
<vxe-column field="name" title="算法名称"></vxe-column>
|
const key = ref('')
|
||||||
<vxe-column field="createTime" title="创建时间"></vxe-column>
|
const listRef = ref()
|
||||||
|
const tabList = ref(['1', '2'])
|
||||||
<vxe-column field="period" title="计算周期">
|
onMounted(() => {
|
||||||
<template #default="{ row }">
|
let key = window.location.href.split('?')[0].slice(-1)
|
||||||
{{
|
const isNumber = /^\d$/.test(key)
|
||||||
row.period == 0
|
if (isNumber) {
|
||||||
? '日'
|
tabList.value = [key]
|
||||||
: row.period == 1
|
activeName.value = key
|
||||||
? '月'
|
}
|
||||||
: row.period == 2
|
})
|
||||||
? '季'
|
const algorithm = (val: any) => {
|
||||||
: row.period == 3
|
activeName.value = '2'
|
||||||
? '年'
|
setTimeout(() => {
|
||||||
: ''
|
listRef.value.getList(val)
|
||||||
}}
|
}, 100)
|
||||||
</template>
|
}
|
||||||
</vxe-column>
|
const layout = mainHeight(63) as any
|
||||||
<vxe-column field="source" title="数据来源"></vxe-column>
|
</script>
|
||||||
<!-- <vxe-column field="useFLag" title="是否启用">
|
|
||||||
<template #default="{ row }">
|
<style lang="scss" scoped>
|
||||||
<el-tag :type="row.useFLag === 1 ? 'success' : 'info'" effect="dark"
|
.bars_w {
|
||||||
style="cursor: pointer" @click="change(row)">
|
width: 100%;
|
||||||
{{ row.useFLag === 1 ? '是' : '否' }}
|
height: 500px;
|
||||||
</el-tag>
|
}
|
||||||
</template>
|
|
||||||
</vxe-column> -->
|
:deep(.el-tabs__content) {
|
||||||
<vxe-column field="definition" title="定义">
|
height: v-bind('layout.height');
|
||||||
<template #default="{ row }">
|
overflow-y: auto;
|
||||||
|
}
|
||||||
<el-button type="primary" link @click="view(row)">查看</el-button>
|
</style>
|
||||||
</template>
|
|
||||||
|
|
||||||
</vxe-column>
|
|
||||||
<!-- <vxe-column title="操作" width="150px">
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-button type="primary" link @click="edit(row)">修改</el-button>
|
|
||||||
<el-button type="danger" link @click="del(row)">删除</el-button>
|
|
||||||
<el-popconfirm title="确定删除吗?" confirm-button-type='danger' @confirm="del(row)">
|
|
||||||
<template #reference>
|
|
||||||
<el-button type="danger" link>删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-popconfirm>
|
|
||||||
</template>
|
|
||||||
</vxe-column> -->
|
|
||||||
</vxe-table>
|
|
||||||
</div>
|
|
||||||
</pane>
|
|
||||||
</splitpanes>
|
|
||||||
<!-- 树弹框 -->
|
|
||||||
<addTree ref="addTreeRef" @getTree="treeRef.loadData(dotList.id)" />
|
|
||||||
<!-- 弹框 -->
|
|
||||||
<PopupEdit ref="popupEditRef" v-if="popupEditFlag"
|
|
||||||
@getTree="treeRef.loadData(dotList.id), (popupEditFlag = false)" />
|
|
||||||
<!-- 定义 -->
|
|
||||||
<el-dialog draggable v-model="viewFlag" title="定义" width="60%">
|
|
||||||
<div style="min-height: 300px; max-height: 55vh;">
|
|
||||||
<div class="editor" ref="editorRef" v-html="summary" />
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
<!-- 删除 -->
|
|
||||||
<el-dialog draggable v-model="dialogVisible" title="请选择需要删除的数据" width="400">
|
|
||||||
<el-tree-select v-model="TreeValue" :data="TreeData" filterable check-strictly :props="defaultProps"
|
|
||||||
default-expand-all :render-after-expand="false" />
|
|
||||||
<template #footer>
|
|
||||||
<div class="dialog-footer">
|
|
||||||
<el-button @click="dialogVisible = false">取消</el-button>
|
|
||||||
<el-button type="primary" @click="del">删除</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { onMounted, ref, provide } from 'vue'
|
|
||||||
import 'splitpanes/dist/splitpanes.css'
|
|
||||||
import { Splitpanes, Pane } from 'splitpanes'
|
|
||||||
import algorithmTree from '@/components/tree/pqs/algorithmTree.vue'
|
|
||||||
import { mainHeight } from '@/utils/layout'
|
|
||||||
import { defaultAttribute } from '@/components/table/defaultAttribute'
|
|
||||||
import { getLineExport, getList, selectReleation } from '@/api/event-boot/report'
|
|
||||||
import addTree from './components/addTree.vue'
|
|
||||||
import PopupEdit from './components/form.vue'
|
|
||||||
import { useMonitoringPoint } from '@/stores/monitoringPoint'
|
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
||||||
import { deleteyById } from '@/api/supervision-boot/database/index'
|
|
||||||
import { queryAllAlgorithmLibrary, updateAlgorithmLibrary } from '@/api/supervision-boot/database/index'
|
|
||||||
import { useAdminInfo } from '@/stores/adminInfo'
|
|
||||||
import katex from "katex";
|
|
||||||
import "katex/dist/katex.css";
|
|
||||||
const adminInfo = useAdminInfo()
|
|
||||||
defineOptions({
|
|
||||||
name: 'database/algorithm'
|
|
||||||
})
|
|
||||||
const monitoringPoint = useMonitoringPoint()
|
|
||||||
const height = mainHeight(20)
|
|
||||||
const heightTab = mainHeight(82)
|
|
||||||
const size = ref(0)
|
|
||||||
const addTreeRef = ref()
|
|
||||||
const editorRef = ref()
|
|
||||||
const dialogVisible = ref(false)
|
|
||||||
const viewFlag = ref(false)
|
|
||||||
const popupEditFlag = ref(false)
|
|
||||||
const treeRef = ref()
|
|
||||||
const summary = ref('')
|
|
||||||
const popupEditRef = ref()
|
|
||||||
const TreeData = ref([])
|
|
||||||
const TreeValue = ref([])
|
|
||||||
const information = adminInfo.roleCode.includes('information_info')
|
|
||||||
|
|
||||||
const defaultProps = {
|
|
||||||
label: 'name',
|
|
||||||
value: 'id'
|
|
||||||
}
|
|
||||||
const dotList: any = ref()
|
|
||||||
|
|
||||||
const templatePolicy: any = ref([])
|
|
||||||
// const tableStore = new TableStore({
|
|
||||||
// url: '/supervision-boot/libalgorithm/queryAllAlgorithmLibrary',
|
|
||||||
// method: 'GET',
|
|
||||||
// column: [
|
|
||||||
// { title: '算法名称', field: 'name' },
|
|
||||||
// {
|
|
||||||
// title: '定义',
|
|
||||||
// field: 'name1'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// title: '计算公式',
|
|
||||||
// field: 'name2'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// title: '计算周期',
|
|
||||||
// field: 'name3'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// title: '数据来源',
|
|
||||||
// field: 'name4'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// title: '是否启用',
|
|
||||||
// field: 'name5',
|
|
||||||
// render: 'tag',
|
|
||||||
// effect: 'dark',
|
|
||||||
// custom: {
|
|
||||||
// 0: 'info',
|
|
||||||
// 1: 'success'
|
|
||||||
// },
|
|
||||||
// replaceValue: {
|
|
||||||
// 0: '否',
|
|
||||||
// 1: '是'
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// ],
|
|
||||||
// loadCallback: () => {}
|
|
||||||
// })
|
|
||||||
const radio = ref(0)
|
|
||||||
|
|
||||||
// 新增弹框
|
|
||||||
const addUser = () => {
|
|
||||||
popupEditFlag.value = true
|
|
||||||
setTimeout(() => {
|
|
||||||
popupEditRef.value.open({
|
|
||||||
title: '新增算法'
|
|
||||||
})
|
|
||||||
}, 100)
|
|
||||||
}
|
|
||||||
// 修改弹框
|
|
||||||
const revise = () => {
|
|
||||||
popupEditFlag.value = true
|
|
||||||
setTimeout(() => {
|
|
||||||
popupEditRef.value.open({
|
|
||||||
title: '修改算法',
|
|
||||||
row: dotList.value
|
|
||||||
})
|
|
||||||
}, 100)
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
const dom = document.getElementById('navigation-splitpanes')
|
|
||||||
if (dom) {
|
|
||||||
size.value = Math.round((180 / dom.offsetHeight) * 100)
|
|
||||||
}
|
|
||||||
// tableStore.index()
|
|
||||||
})
|
|
||||||
|
|
||||||
const view = (row: any) => {
|
|
||||||
|
|
||||||
viewFlag.value = true
|
|
||||||
summary.value = row.definition
|
|
||||||
setTimeout(() => {
|
|
||||||
|
|
||||||
const spans = document.querySelectorAll('span[data-value]');
|
|
||||||
// 遍历每个 span 标签
|
|
||||||
spans.forEach(function (span) {
|
|
||||||
|
|
||||||
let val = katex.renderToString(span.getAttribute('data-value'), {
|
|
||||||
throwOnError: false,
|
|
||||||
})
|
|
||||||
// var newDiv = document.createElement('div');
|
|
||||||
var newDiv = span
|
|
||||||
newDiv.innerHTML = val;
|
|
||||||
|
|
||||||
span.parentNode.replaceChild(newDiv, span);
|
|
||||||
});
|
|
||||||
|
|
||||||
}, 100)
|
|
||||||
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const handleNodeClick = (data: any, node: any) => {
|
|
||||||
if (data.pid != '0') {
|
|
||||||
dotList.value = data
|
|
||||||
radio.value = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const onAddTree = () => {
|
|
||||||
addTreeRef.value.open('新增')
|
|
||||||
}
|
|
||||||
const deletes = () => {
|
|
||||||
TreeValue.value = []
|
|
||||||
queryAllAlgorithmLibrary().then(res => {
|
|
||||||
TreeData.value = res.data
|
|
||||||
})
|
|
||||||
dialogVisible.value = true
|
|
||||||
}
|
|
||||||
// 删除
|
|
||||||
const del = () => {
|
|
||||||
if (TreeValue.value.length == 0) {
|
|
||||||
return ElMessage.warning('请选择数据')
|
|
||||||
}
|
|
||||||
ElMessageBox.confirm('此操作将永久删除, 是否继续?', '提示', {
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning'
|
|
||||||
}).then(() => {
|
|
||||||
deleteyById({ id: TreeValue.value }).then(res => {
|
|
||||||
ElMessage.success('删除成功')
|
|
||||||
dialogVisible.value = false
|
|
||||||
treeRef.value.loadData()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
// if (TreeValue.value.length > 0) {
|
|
||||||
// ElMessage.warning('请选择数据')
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
// 启用
|
|
||||||
const change = (row: any) => {
|
|
||||||
console.log('🚀 ~ change ~ row:', row)
|
|
||||||
ElMessageBox.confirm(`请确认是否${row.useFLag == 0 ? '启用' : '关闭'}算法?`, '提示', {
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning'
|
|
||||||
}).then(() => {
|
|
||||||
updateAlgorithmLibrary({ ...row, useFLag: row.useFLag == 0 ? 1 : 0 }).then(res => {
|
|
||||||
ElMessage.success(row.useFLag == 0 ? '启用' : '关闭' + '成功')
|
|
||||||
treeRef.value.loadData(dotList.value.id)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<style lang="scss">
|
|
||||||
.splitpanes.default-theme .splitpanes__pane {
|
|
||||||
background: #eaeef1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.grid-content {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-divider--horizontal {
|
|
||||||
margin: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mTop {
|
|
||||||
margin-top: 5px;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.boxTop {
|
|
||||||
height: 52px;
|
|
||||||
padding: 10px 10px 10px 0;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
.editor {
|
|
||||||
table {
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: collapse;
|
|
||||||
}
|
|
||||||
|
|
||||||
th,
|
|
||||||
td {
|
|
||||||
border: 1px solid black;
|
|
||||||
padding: 8px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
th {
|
|
||||||
background-color: #f2f2f2;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
td {
|
|
||||||
background-color: #ffffff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
359
src/views/pqs/database/algorithm/list.vue
Normal file
@@ -0,0 +1,359 @@
|
|||||||
|
<template>
|
||||||
|
<div class="default-main" :style="height">
|
||||||
|
<!-- 算法库 -->
|
||||||
|
<splitpanes style="height: 100%" class="default-theme" id="navigation-splitpanes">
|
||||||
|
<pane :size="size">
|
||||||
|
<algorithmTree
|
||||||
|
ref="treeRef"
|
||||||
|
:default-expand-all="false"
|
||||||
|
:default-expanded-keys="monitoringPoint.state.lineId ? [monitoringPoint.state.lineId] : []"
|
||||||
|
:current-node-key="monitoringPoint.state.lineId"
|
||||||
|
@node-click="handleNodeClick"
|
||||||
|
@init="handleNodeClick"
|
||||||
|
@onAddTree="onAddTree"
|
||||||
|
></algorithmTree>
|
||||||
|
</pane>
|
||||||
|
<pane style="background: #fff; width: 100%" :style="height">
|
||||||
|
<div class="boxTop">
|
||||||
|
<div>
|
||||||
|
<el-radio-group v-model="radio">
|
||||||
|
<el-radio-button v-for="(item, i) in dotList?.childrens" :label="item.name" :value="i" />
|
||||||
|
</el-radio-group>
|
||||||
|
</div>
|
||||||
|
<div v-if="information">
|
||||||
|
<el-button icon="el-icon-Plus" type="primary" @click="addUser">新增</el-button>
|
||||||
|
<el-button icon="el-icon-Edit" type="primary" @click="revise">修改</el-button>
|
||||||
|
<el-button icon="el-icon-Delete" type="primary" @click="deletes">删除</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div :style="heightTab">
|
||||||
|
<vxe-table height="auto" v-bind="defaultAttribute" :data="dotList?.childrens[radio]?.children">
|
||||||
|
<vxe-column field="name" title="算法名称"></vxe-column>
|
||||||
|
<vxe-column field="createTime" title="创建时间"></vxe-column>
|
||||||
|
|
||||||
|
<vxe-column field="period" title="计算周期">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{
|
||||||
|
row.period == 0
|
||||||
|
? '日'
|
||||||
|
: row.period == 1
|
||||||
|
? '月'
|
||||||
|
: row.period == 2
|
||||||
|
? '季'
|
||||||
|
: row.period == 3
|
||||||
|
? '年'
|
||||||
|
: ''
|
||||||
|
}}
|
||||||
|
</template>
|
||||||
|
</vxe-column>
|
||||||
|
<vxe-column field="source" title="数据来源"></vxe-column>
|
||||||
|
<!-- <vxe-column field="useFLag" title="是否启用">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag :type="row.useFLag === 1 ? 'success' : 'info'" effect="dark"
|
||||||
|
style="cursor: pointer" @click="change(row)">
|
||||||
|
{{ row.useFLag === 1 ? '是' : '否' }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</vxe-column> -->
|
||||||
|
<vxe-column field="definition" title="定义">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="primary" link @click="view(row)">查看</el-button>
|
||||||
|
</template>
|
||||||
|
</vxe-column>
|
||||||
|
<!-- <vxe-column title="操作" width="150px">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="primary" link @click="edit(row)">修改</el-button>
|
||||||
|
<el-button type="danger" link @click="del(row)">删除</el-button>
|
||||||
|
<el-popconfirm title="确定删除吗?" confirm-button-type='danger' @confirm="del(row)">
|
||||||
|
<template #reference>
|
||||||
|
<el-button type="danger" link>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-popconfirm>
|
||||||
|
</template>
|
||||||
|
</vxe-column> -->
|
||||||
|
</vxe-table>
|
||||||
|
</div>
|
||||||
|
</pane>
|
||||||
|
</splitpanes>
|
||||||
|
<!-- 树弹框 -->
|
||||||
|
<addTree ref="addTreeRef" @getTree="treeRef.loadData(dotList.id)" />
|
||||||
|
<!-- 弹框 -->
|
||||||
|
<PopupEdit
|
||||||
|
ref="popupEditRef"
|
||||||
|
v-if="popupEditFlag"
|
||||||
|
@getTree="treeRef.loadData(dotList.id), (popupEditFlag = false)"
|
||||||
|
/>
|
||||||
|
<!-- 定义 -->
|
||||||
|
<el-dialog draggable v-model="viewFlag" title="定义" width="60%">
|
||||||
|
<div style="min-height: 300px; max-height: 55vh">
|
||||||
|
<div class="editor" ref="editorRef" v-html="summary" />
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
<!-- 删除 -->
|
||||||
|
<el-dialog draggable v-model="dialogVisible" title="请选择需要删除的数据" width="400">
|
||||||
|
<el-tree-select
|
||||||
|
v-model="TreeValue"
|
||||||
|
:data="TreeData"
|
||||||
|
filterable
|
||||||
|
check-strictly
|
||||||
|
:props="defaultProps"
|
||||||
|
default-expand-all
|
||||||
|
:render-after-expand="false"
|
||||||
|
/>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="dialogVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="del">删除</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, ref, provide, nextTick } from 'vue'
|
||||||
|
import 'splitpanes/dist/splitpanes.css'
|
||||||
|
import { Splitpanes, Pane } from 'splitpanes'
|
||||||
|
import algorithmTree from '@/components/tree/pqs/algorithmTree.vue'
|
||||||
|
import { mainHeight } from '@/utils/layout'
|
||||||
|
import { defaultAttribute } from '@/components/table/defaultAttribute'
|
||||||
|
import { getLineExport, selectReleation } from '@/api/event-boot/report'
|
||||||
|
import addTree from './components/addTree.vue'
|
||||||
|
import PopupEdit from './components/form.vue'
|
||||||
|
import { useMonitoringPoint } from '@/stores/monitoringPoint'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
import { deleteyById } from '@/api/supervision-boot/database/index'
|
||||||
|
import { queryAllAlgorithmLibrary, updateAlgorithmLibrary } from '@/api/supervision-boot/database/index'
|
||||||
|
import { useAdminInfo } from '@/stores/adminInfo'
|
||||||
|
import katex from 'katex'
|
||||||
|
import 'katex/dist/katex.css'
|
||||||
|
const adminInfo = useAdminInfo()
|
||||||
|
defineOptions({
|
||||||
|
name: 'database/algorithm'
|
||||||
|
})
|
||||||
|
const monitoringPoint = useMonitoringPoint()
|
||||||
|
const height = mainHeight(20)
|
||||||
|
const heightTab = mainHeight(82)
|
||||||
|
const size = ref(23)
|
||||||
|
const addTreeRef = ref()
|
||||||
|
const editorRef = ref()
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const viewFlag = ref(false)
|
||||||
|
const popupEditFlag = ref(false)
|
||||||
|
const treeRef = ref()
|
||||||
|
const summary = ref('')
|
||||||
|
const popupEditRef = ref()
|
||||||
|
const TreeData = ref([])
|
||||||
|
const TreeValue = ref([])
|
||||||
|
const information = adminInfo.roleCode.includes('information_info')
|
||||||
|
|
||||||
|
const defaultProps = {
|
||||||
|
label: 'name',
|
||||||
|
value: 'id'
|
||||||
|
}
|
||||||
|
const dotList: any = ref()
|
||||||
|
|
||||||
|
const templatePolicy: any = ref([])
|
||||||
|
// const tableStore = new TableStore({
|
||||||
|
// url: '/supervision-boot/libalgorithm/queryAllAlgorithmLibrary',
|
||||||
|
// method: 'GET',
|
||||||
|
// column: [
|
||||||
|
// { title: '算法名称', field: 'name' },
|
||||||
|
// {
|
||||||
|
// title: '定义',
|
||||||
|
// field: 'name1'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '计算公式',
|
||||||
|
// field: 'name2'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '计算周期',
|
||||||
|
// field: 'name3'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '数据来源',
|
||||||
|
// field: 'name4'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '是否启用',
|
||||||
|
// field: 'name5',
|
||||||
|
// render: 'tag',
|
||||||
|
// effect: 'dark',
|
||||||
|
// custom: {
|
||||||
|
// 0: 'info',
|
||||||
|
// 1: 'success'
|
||||||
|
// },
|
||||||
|
// replaceValue: {
|
||||||
|
// 0: '否',
|
||||||
|
// 1: '是'
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
// loadCallback: () => {}
|
||||||
|
// })
|
||||||
|
const radio = ref(0)
|
||||||
|
|
||||||
|
// 新增弹框
|
||||||
|
const addUser = () => {
|
||||||
|
popupEditFlag.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
popupEditRef.value.open({
|
||||||
|
title: '新增算法'
|
||||||
|
})
|
||||||
|
}, 100)
|
||||||
|
}
|
||||||
|
// 修改弹框
|
||||||
|
const revise = () => {
|
||||||
|
popupEditFlag.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
popupEditRef.value.open({
|
||||||
|
title: '修改算法',
|
||||||
|
row: dotList.value
|
||||||
|
})
|
||||||
|
}, 100)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
const dom = document.getElementById('navigation-splitpanes')
|
||||||
|
if (dom) {
|
||||||
|
size.value = Math.round((180 / dom.offsetHeight) * 120)
|
||||||
|
}
|
||||||
|
// tableStore.index()
|
||||||
|
})
|
||||||
|
|
||||||
|
const view = (row: any) => {
|
||||||
|
viewFlag.value = true
|
||||||
|
summary.value = row.definition
|
||||||
|
setTimeout(() => {
|
||||||
|
const spans = document.querySelectorAll('span[data-value]')
|
||||||
|
// 遍历每个 span 标签
|
||||||
|
spans.forEach(function (span) {
|
||||||
|
let val = katex.renderToString(span.getAttribute('data-value'), {
|
||||||
|
throwOnError: false
|
||||||
|
})
|
||||||
|
// var newDiv = document.createElement('div');
|
||||||
|
var newDiv = span
|
||||||
|
newDiv.innerHTML = val
|
||||||
|
|
||||||
|
span.parentNode.replaceChild(newDiv, span)
|
||||||
|
})
|
||||||
|
}, 100)
|
||||||
|
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleNodeClick = (data: any, node: any) => {
|
||||||
|
if (data.pid != '0') {
|
||||||
|
dotList.value = data
|
||||||
|
radio.value = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const onAddTree = () => {
|
||||||
|
addTreeRef.value.open('新增')
|
||||||
|
}
|
||||||
|
const deletes = () => {
|
||||||
|
TreeValue.value = []
|
||||||
|
queryAllAlgorithmLibrary().then(res => {
|
||||||
|
TreeData.value = res.data
|
||||||
|
})
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
// 删除
|
||||||
|
const del = () => {
|
||||||
|
if (TreeValue.value.length == 0) {
|
||||||
|
return ElMessage.warning('请选择数据')
|
||||||
|
}
|
||||||
|
ElMessageBox.confirm('此操作将永久删除, 是否继续?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
deleteyById({ id: TreeValue.value }).then(res => {
|
||||||
|
ElMessage.success('删除成功')
|
||||||
|
dialogVisible.value = false
|
||||||
|
treeRef.value.loadData()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// if (TreeValue.value.length > 0) {
|
||||||
|
// ElMessage.warning('请选择数据')
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
// 启用
|
||||||
|
const change = (row: any) => {
|
||||||
|
console.log('🚀 ~ change ~ row:', row)
|
||||||
|
ElMessageBox.confirm(`请确认是否${row.useFLag == 0 ? '启用' : '关闭'}算法?`, '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
updateAlgorithmLibrary({ ...row, useFLag: row.useFLag == 0 ? 1 : 0 }).then(res => {
|
||||||
|
ElMessage.success(row.useFLag == 0 ? '启用' : '关闭' + '成功')
|
||||||
|
treeRef.value.loadData(dotList.value.id)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const getList = (val: any) => {
|
||||||
|
setTimeout(async () => {
|
||||||
|
dotList.value = await treeRef.value.setKey(val.data.pid)
|
||||||
|
await dotList.value?.childrens.forEach((item: any, i: number) => {
|
||||||
|
if (item.id == val.data.id) {
|
||||||
|
radio.value = i
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
getList
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.splitpanes.default-theme .splitpanes__pane {
|
||||||
|
background: #eaeef1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-content {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-divider--horizontal {
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mTop {
|
||||||
|
margin-top: 5px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.boxTop {
|
||||||
|
height: 52px;
|
||||||
|
padding: 10px 10px 10px 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor {
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
th,
|
||||||
|
td {
|
||||||
|
border: 1px solid black;
|
||||||
|
padding: 8px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
196
src/views/pqs/database/algorithm/overview.vue
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
<template>
|
||||||
|
<div class="default-main pt50" :style="height">
|
||||||
|
<!-- 算法库 -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<MyEchart :options="echartList" style="width: 100%" :style="height" @echart-click="echartClick"></MyEchart>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, ref, provide } from 'vue'
|
||||||
|
import 'splitpanes/dist/splitpanes.css'
|
||||||
|
|
||||||
|
import { mainHeight } from '@/utils/layout'
|
||||||
|
|
||||||
|
import MyEchart from '@/components/echarts/MyEchart.vue'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import { queryAllAlgorithmLibrary, updateAlgorithmLibrary } from '@/api/supervision-boot/database/index'
|
||||||
|
import { useAdminInfo } from '@/stores/adminInfo'
|
||||||
|
import 'katex/dist/katex.css'
|
||||||
|
import { useConfig } from '@/stores/config'
|
||||||
|
const router = useRouter()
|
||||||
|
const config = useConfig()
|
||||||
|
const adminInfo = useAdminInfo()
|
||||||
|
defineOptions({
|
||||||
|
name: 'database/algorithm'
|
||||||
|
})
|
||||||
|
const emits = defineEmits(['algorithm'])
|
||||||
|
const height = mainHeight(20)
|
||||||
|
const size = ref(23)
|
||||||
|
|
||||||
|
const popupEditFlag = ref(false)
|
||||||
|
|
||||||
|
const popupEditRef = ref()
|
||||||
|
const TreeList: any = ref([])
|
||||||
|
|
||||||
|
const echartList = ref({})
|
||||||
|
|
||||||
|
const dotList: any = ref()
|
||||||
|
|
||||||
|
const radio = ref(0)
|
||||||
|
|
||||||
|
// 新增弹框
|
||||||
|
const addUser = () => {
|
||||||
|
popupEditFlag.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
popupEditRef.value.open({
|
||||||
|
title: '新增算法'
|
||||||
|
})
|
||||||
|
}, 100)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
const dom = document.getElementById('navigation-splitpanes')
|
||||||
|
if (dom) {
|
||||||
|
size.value = Math.round((180 / dom.offsetHeight) * 120)
|
||||||
|
}
|
||||||
|
info()
|
||||||
|
// tableStore.index()
|
||||||
|
})
|
||||||
|
|
||||||
|
const info = () => {
|
||||||
|
queryAllAlgorithmLibrary().then(async res => {
|
||||||
|
TreeList.value = await setTreeAllNodeExpand([
|
||||||
|
{
|
||||||
|
name: '算法库',
|
||||||
|
level: 0,
|
||||||
|
children: res.data
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
echartList.value = {
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
type: 'tree',
|
||||||
|
data: TreeList.value,
|
||||||
|
top: '20',
|
||||||
|
bottom: '40',
|
||||||
|
left: '20',
|
||||||
|
symbolSize: 7,
|
||||||
|
label: {
|
||||||
|
position: 'left',
|
||||||
|
verticalAlign: 'middle',
|
||||||
|
align: 'left',
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: 600,
|
||||||
|
backgroundColor: config.layout.elementUiPrimary[0],
|
||||||
|
color: '#fff',
|
||||||
|
borderRadius: 5,
|
||||||
|
formatter: function (params) {
|
||||||
|
return [`{name|${params.data.name}}`]
|
||||||
|
},
|
||||||
|
rich: {
|
||||||
|
name: {
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
padding: [10, 10]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
leaves: {
|
||||||
|
label: {
|
||||||
|
position: 'left',
|
||||||
|
verticalAlign: 'middle',
|
||||||
|
fontWeight: 600,
|
||||||
|
align: 'left'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
edgeShape: 'polyline', // 折线连接线
|
||||||
|
roam: true, // 可移动,可缩放
|
||||||
|
expandAndCollapse: false,
|
||||||
|
animationDuration: 550,
|
||||||
|
animationDurationUpdate: 750
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 点击echart
|
||||||
|
const echartClick = (params: any) => {
|
||||||
|
if(params.data.level == 3){
|
||||||
|
emits('algorithm', params)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const setTreeAllNodeExpand = (treeData: any) => {
|
||||||
|
if (!treeData) return []
|
||||||
|
// 兼容单对象/数组两种树数据格式
|
||||||
|
const data = Array.isArray(treeData) ? treeData : [treeData]
|
||||||
|
return data.map(node => {
|
||||||
|
// 深拷贝节点,彻底隔离原数据
|
||||||
|
const newNode = {
|
||||||
|
...node,
|
||||||
|
collapsed: node.level <= 2 ? false : true // 强制添加展开属性
|
||||||
|
}
|
||||||
|
// 递归处理子节点
|
||||||
|
if (node.children && node.children.length > 0) {
|
||||||
|
newNode.children = setTreeAllNodeExpand(node.children)
|
||||||
|
}
|
||||||
|
return newNode
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.splitpanes.default-theme .splitpanes__pane {
|
||||||
|
background: #eaeef1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-content {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-divider--horizontal {
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mTop {
|
||||||
|
margin-top: 5px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.boxTop {
|
||||||
|
height: 52px;
|
||||||
|
padding: 10px 10px 10px 0;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor {
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
th,
|
||||||
|
td {
|
||||||
|
border: 1px solid black;
|
||||||
|
padding: 8px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.button {
|
||||||
|
position: absolute;
|
||||||
|
right: 10px;
|
||||||
|
top: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -50,6 +50,7 @@ import { ref, reactive } from 'vue'
|
|||||||
import { defaultAttribute } from '@/components/table/defaultAttribute'
|
import { defaultAttribute } from '@/components/table/defaultAttribute'
|
||||||
import { getFileNameAndFilePath, downloadFile } from '@/api/system-boot/file'
|
import { getFileNameAndFilePath, downloadFile } from '@/api/system-boot/file'
|
||||||
import { Download, View } from '@element-plus/icons-vue'
|
import { Download, View } from '@element-plus/icons-vue'
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const tableData: any = ref({
|
const tableData: any = ref({
|
||||||
|
|
||||||
|
|||||||