24 Commits

Author SHA1 Message Date
guanj
dd0dab7643 添加工程信息管理 页面 2026-02-02 13:56:50 +08:00
guanj
cf4291ed9a 修改报表 2026-01-28 10:16:05 +08:00
guanj
46124f0ea5 修改全局报表功能 2026-01-27 16:32:33 +08:00
guanj
def48e9c84 修改测试bug 2026-01-23 09:24:13 +08:00
guanj
823d5f4475 修改问题 2026-01-20 14:39:13 +08:00
guanj
c09e6f54dd 修改测试问题 2026-01-16 15:54:16 +08:00
guanj
5ceb9be9e2 修改测试问题 2026-01-15 15:59:13 +08:00
guanj
054d84778b 优化表格 2026-01-14 13:30:23 +08:00
guanj
63433aa6dc 云平台自测问题修改 2026-01-13 14:27:23 +08:00
guanj
e9d7231a75 修改测试用例1 2026-01-12 11:06:54 +08:00
guanj
08afdddc51 修改数据来源 2026-01-08 20:08:26 +08:00
guanj
e21ae50e51 修改数据来源 2026-01-08 19:51:43 +08:00
guanj
4cbd2e43cb 修改告警级别 2026-01-08 19:20:32 +08:00
guanj
4c9b677e81 修改监测点列表 2026-01-08 14:09:43 +08:00
guanj
0affb17e3a 修改监测列表页面 2026-01-08 13:48:40 +08:00
guanj
c2d0faea08 修改在线设备 2026-01-08 11:33:40 +08:00
guanj
0d155c8680 优化页面 2026-01-08 11:32:01 +08:00
guanj
3db01fe32d 修改驾驶舱组件重复绑定问题 2026-01-08 10:08:51 +08:00
guanj
545e3836d1 修改测试问题 2026-01-07 21:01:28 +08:00
guanj
02a95c1dcd 修改测试bug,优化页面 2026-01-07 13:14:26 +08:00
guanj
7a81c008c3 修改组件页面 2026-01-06 15:42:33 +08:00
guanj
5d3d16f8ec 修改测试bug 2026-01-06 11:35:11 +08:00
guanj
d25f16bcc7 添加系统绑的功能 2026-01-05 16:34:42 +08:00
guanj
75987c0c6f 修改测试问题 2026-01-05 11:31:50 +08:00
159 changed files with 12384 additions and 9388 deletions

View File

@@ -31,4 +31,11 @@ export function getCldTree() {
method: 'POST' method: 'POST'
}) })
} }
//报表树
export function lineTree() {
return createAxios({
url: '/cs-device-boot/csLedger/lineTree',
method: 'POST'
})
}

View File

@@ -1,41 +1,82 @@
import request from '@/utils/request' import request from '@/utils/request'
// 新增程序版本 // 新增程序版本
export const addEdData = (data) => { export const addEdData = data => {
return request({ return request({
url: '/cs-device-boot/edData/addEdData', url: '/cs-device-boot/edData/addEdData',
method: 'post', method: 'post',
headers: { headers: {
'Content-Type': 'multipart/form-data', 'Content-Type': 'multipart/form-data'
}, },
data: data, data: data
}) })
} }
export const auditEdData = (data) => { export const auditEdData = data => {
return request({ return request({
url: '/cs-device-boot/edData/auditEdData', url: '/cs-device-boot/edData/auditEdData',
method: 'post', method: 'post',
headers: { headers: {
'Content-Type': 'multipart/form-data', 'Content-Type': 'multipart/form-data'
}, },
data: data, data: data
}) })
} }
// 修改-删除工程 // 修改-删除工程
export const auditEngineering = (data:any)=> { export const auditEngineering = (data: any) => {
return request({ return request({
url: '/cs-device-boot/engineering/auditEngineering', url: '/cs-device-boot/engineering/auditEngineering',
method: 'post', method: 'post',
data: data, data: data
}) })
} }
// 修改项目 // 修改项目
export const updateProject = (data:any) => { export const updateProject = (data: any) => {
return request({ return request({
url: '/cs-device-boot/project/updateProject', url: '/cs-device-boot/project/updateProject',
method: 'post', method: 'post',
data: data, data: data
}) })
} }
// 新增工程
export const addEngineering = (data: any) => {
return request({
url: '/cs-device-boot/engineeringProjectRelation/addEngineering',
method: 'post',
data: data
})
}
// 修改工程
export const updateEngineering = (data: any) => {
return request({
url: '/cs-device-boot/engineeringProjectRelation/updateEngineering',
method: 'post',
data: data
})
}
// 刪除工程
export const deleteEngineering = (data: any) => {
return request({
url: '/cs-device-boot/engineeringProjectRelation/deleteEngineering',
method: 'post',
params: data
})
}
// 刪除項目
export const deleteProject = (data: any) => {
return request({
url: '/cs-device-boot/engineeringProjectRelation/deleteProject',
method: 'post',
params: data
})
}
// 新增项目
export const addProject = (data: any) => {
return request({
url: '/cs-device-boot/engineeringProjectRelation/addProject',
method: 'post',
data: data
})
}

View File

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

View File

@@ -3,7 +3,7 @@ import createAxios from '@/utils/request'
// 获取设备补召页面数据 // 获取设备补召页面数据
export function getMakeUpData(data: any) { export function getMakeUpData(data: any) {
return createAxios({ return createAxios({
url: '/cs-harmonic-boot/offlineDataUpload/makeUpData?lineId='+data, url: '/cs-harmonic-boot/offlineDataUpload/makeUpData?lineId=' + data,
method: 'POST' method: 'POST'
}) })
} }
@@ -30,7 +30,14 @@ export function offlineDataUploadMakeUp(data: any) {
export function getListByIds() { export function getListByIds() {
return createAxios({ return createAxios({
url: '/cs-harmonic-boot/pqSensitiveUser/getListByIds', url: '/cs-harmonic-boot/pqSensitiveUser/getListByIds',
method: 'POST', method: 'POST'
})
}
// 根据id集合获取敏感负荷用户列表
export function getList(data) {
return createAxios({
url: '/cs-harmonic-boot/pqSensitiveUser/getList',
method: 'POST',
data
}) })
} }

View File

@@ -1,20 +1,30 @@
import createAxios from '@/utils/request' import createAxios from '@/utils/request'
// 更新问题状态 // 更新问题状态
export function auditFeedBack(data: any) { export function auditFeedBack(data: any) {
return createAxios({ return createAxios({
url: '/cs-system-boot/feedback/auditFeedBack', url: '/cs-system-boot/feedback/auditFeedBack',
method: 'post', method: 'post',
params: data params: data
}) })
} }
//下载文件 //下载文件
export function downLoadFile(filePath: any) { export function downLoadFile(filePath: any) {
return createAxios({ return createAxios({
url: '/system-boot/file/download', url: '/system-boot/file/download',
method: 'get', method: 'get',
responseType: 'blob', responseType: 'blob',
params: { filePath: filePath } params: { filePath: filePath }
}) })
}
//获取文件的一个短期url
export function getFileUrl(filePath: any) {
return createAxios({
url: '/system-boot/file/getFileUrl',
method: 'get',
// responseType: 'blob',
params: { filePath: filePath }
})
} }

View File

@@ -1,5 +1,5 @@
import request from '@/utils/request' import request from '@/utils/request'
import { genFileId, ElMessage, ElNotification } from 'element-plus'
// 主要监测点列表查询>>分页 // 主要监测点列表查询>>分页
export function mainLineList(data: any) { export function mainLineList(data: any) {
return request({ return request({
@@ -115,7 +115,6 @@ export function limitProbabilityData(data: any) {
}) })
} }
// 电网侧指标越限统计列表 // 电网侧指标越限统计列表
export function gridSideLimitStatisticsList(data: any) { export function gridSideLimitStatisticsList(data: any) {
return request({ return request({
@@ -152,7 +151,6 @@ export function getListByIds(data: any) {
}) })
} }
// 上传治理报告 // 上传治理报告
export function uploadReport(data: any) { export function uploadReport(data: any) {
return request({ return request({
@@ -260,14 +258,42 @@ export function getSimpleLine() {
}) })
} }
export function getLineExport(data: any) {
export function getLineExport(data:any) {
return request({ return request({
url: '/cs-harmonic-boot/eventReport/getLineExport', url: '/cs-harmonic-boot/eventReport/getLineExport',
method: 'post', method: 'post',
data: data, data: data,
responseType: 'blob' responseType: 'blob'
}).then(async res => {
let load: any = await readJsonBlob(res)
if (load.code) {
if (load.data.code == 'A0011') {
ElMessage.warning('下载失败!')
} else {
ElMessage.warning(load.data.message)
}
} else {
return res
}
}) })
} }
async function readJsonBlob(blob) {
try {
// 1. Blob.text() 读取二进制 → 直接转为 字符串(自动处理编码)
const jsonStr = await blob.text()
// 2. JSON.parse 解析字符串 → 得到可用的 JS 对象/数组
const jsonData = JSON.parse(jsonStr)
// 3. 拿到数据,后续随便用
return {
code: true,
data: jsonData
}
} catch (err) {
return {
code: false,
data: {}
}
// console.error('解析Blob的JSON数据失败', err)
}
}

View File

@@ -103,6 +103,14 @@ export function getTemplateByDept(params) {
params params
}) })
} }
// 获取模版
export function querySysExcel(params) {
return createAxios({
url: '/cs-harmonic-boot/sysExcel/querySysExcel',
method: 'post',
params
})
}
//资源管理 查询数据 //资源管理 查询数据
export function queryData(data) { export function queryData(data) {
return createAxios({ return createAxios({
@@ -168,3 +176,43 @@ export function terminalChooseTree() {
method: 'get' method: 'get'
}) })
} }
//新增模版
export function addSysExcel(data:any) {
return createAxios({
url: '/cs-harmonic-boot/sysExcel/addSysExcel',
method: 'post',
data
})
}
//修改模版
export function updateSysExcel(data:any) {
return createAxios({
url: '/cs-harmonic-boot/sysExcel/updateSysExcel',
method: 'post',
data
})
}
//删除模版
export function deleteSysExcel(params:any) {
return createAxios({
url: '/cs-harmonic-boot/sysExcel/deleteSysExcel',
method: 'post',
params
})
}
//查詢綁定
export function queryList(params:any) {
return createAxios({
url: '/cs-harmonic-boot/sysExcelRelation/queryList',
method: 'post',
params
})
}
//綁定
export function bandRelation(data:any) {
return createAxios({
url: '/cs-harmonic-boot/sysExcelRelation/bandRelation',
method: 'post',
data
})
}

View File

@@ -1,21 +1,33 @@
import createAxios from '@/utils/request' import createAxios from '@/utils/request'
export function getFunctionsByRoleIndex(data) { export function getFunctionsByRoleIndex(data) {
return createAxios({ return createAxios({
url: '/user-boot/roleFunction/getFunctionsByRoleIndex', url: '/user-boot/roleFunction/getFunctionsByRoleIndex',
method: 'post', method: 'post',
params: data params: data
}) })
} }
export function updateRoleMenu(data:any) { export function updateRoleMenu(data: any) {
return createAxios({ return createAxios({
url: '/user-boot/function/assignFunctionByRoleIndexes', url: '/user-boot/function/assignFunctionByRoleIndexes',
method: 'post', method: 'post',
data: data data: data
// params: roleIndex,functionIndexList })
// data:{ }
// roleIndex,functionIndexList // 新增角色与系统关系
// } export function systemAdd(data: any) {
}) return createAxios({
} url: '/user-boot/sysRoleSystem/add',
method: 'post',
data: data
})
}
// 根据角色id获取系统信息
export function getSystemByRoleId(params: any) {
return createAxios({
url: '/user-boot/sysRoleSystem/getSystemByRoleId',
method: 'get',
params
})
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 213 KiB

View File

@@ -1,7 +1,14 @@
<template> <template>
<div> <div>
<!--F47曲线 --> <!--F47曲线 -->
<TableHeader ref="TableHeaderRef" :showReset="false" :timeKeyList="prop.timeKey" @selectChange="selectChange" datePicker v-if="fullscreen"></TableHeader> <TableHeader
ref="TableHeaderRef"
:showReset="false"
:timeKeyList="prop.timeKey"
@selectChange="selectChange"
datePicker
v-if="fullscreen"
></TableHeader>
<el-descriptions class="mt2" direction="vertical" :column="4" border> <el-descriptions class="mt2" direction="vertical" :column="4" border>
<el-descriptions-item align="center" label="名称">{{ data.name }}</el-descriptions-item> <el-descriptions-item align="center" label="名称">{{ data.name }}</el-descriptions-item>
<el-descriptions-item align="center" label="事件总数">{{ data.gs }}</el-descriptions-item> <el-descriptions-item align="center" label="事件总数">{{ data.gs }}</el-descriptions-item>
@@ -44,7 +51,7 @@ const prop = defineProps({
h: { type: [String, Number] }, h: { type: [String, Number] },
width: { type: [String, Number] }, width: { type: [String, Number] },
height: { type: [String, Number] }, height: { type: [String, Number] },
timeKey: { type: Array as () => string[] }, timeKey: { type: Array as () => string[] },
timeValue: { type: Object }, timeValue: { type: Object },
interval: { type: Number } interval: { type: Number }
}) })
@@ -109,8 +116,8 @@ const tableStore: any = new TableStore({
loadCallback: () => { loadCallback: () => {
const gongData = gongfunction(tableStore.table.data) const gongData = gongfunction(tableStore.table.data)
data.gs = tableStore.table.data.length data.gs = tableStore.table.data.length
data.krr = gongData.pointI.length data.krr = gongData.pointF.length
data.bkrr = gongData.pointIun.length data.bkrr = gongData.pointFun.length
echartList.value = { echartList.value = {
title: { title: {
text: `F47曲线` text: `F47曲线`
@@ -162,11 +169,16 @@ const tableStore: any = new TableStore({
yAxis: [ yAxis: [
{ {
type: 'value', type: 'value',
max: function (value: any) { // max: function (value: any) {
return value.max + 20 // return value.max + 20
// },
max: function (value) {
// 先取原始最大值+20再向上取整到最近的10的倍数确保刻度够用且规整
return Math.ceil((value.max + 20) / 10) * 10
}, },
splitNumber: 10, // splitNumber: 10,
minInterval: 0.1, // interval: 10,
// minInterval: 10,
name: '%' name: '%'
} }
], ],
@@ -203,15 +215,7 @@ const tableStore: any = new TableStore({
// [0.4, 50, '2023-01-01 11:00:00'] // [0.4, 50, '2023-01-01 11:00:00']
// ], // ],
legendSymbol: 'circle', legendSymbol: 'circle',
emphasis: {
focus: 'series',
itemStyle: {
borderColor: '#fff',
borderWidth: 2,
shadowBlur: 10,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
tooltip: { tooltip: {
show: true, show: true,
trigger: 'item', trigger: 'item',
@@ -449,7 +453,7 @@ const handleTolerableEventClick = async (row: any) => {
// waveFormAnalysisRef.value.setHeight(999, 130, 1.6666666) // waveFormAnalysisRef.value.setHeight(999, 130, 1.6666666)
} }
}) })
const messageInstance = ElMessage.info(`正在加载,请稍等...`) const messageInstance = ElMessage.info(`正在加载,请稍等...`)
await analyseWave(row.value[3]) //eventId await analyseWave(row.value[3]) //eventId
.then(res => { .then(res => {
row.loading1 = false row.loading1 = false
@@ -474,7 +478,7 @@ const handleTolerableEventClick = async (row: any) => {
}) })
nextTick(() => { nextTick(() => {
waveFormAnalysisRef.value && waveFormAnalysisRef.value.setHeight(999, 130, 1.6666666) waveFormAnalysisRef.value && waveFormAnalysisRef.value.setHeight(999, 130, 1.6666666)
waveFormAnalysisRef.value && waveFormAnalysisRef.value.getWpData(wp.value, boxoList.value, true) waveFormAnalysisRef.value && waveFormAnalysisRef.value.getWpData(wp.value, boxoList.value, true)
}) })
} }

View File

@@ -17,7 +17,7 @@ import { yMethod } from '@/utils/echartMethod'
const prop = defineProps({ const prop = defineProps({
width: { type: [String, Number] }, width: { type: [String, Number] },
height: { type: [String, Number] }, height: { type: [String, Number] },
timeKey: { type: Array as () => string[] }, timeKey: { type: Array as () => string[] },
timeValue: { type: Object } timeValue: { type: Object }
}) })
@@ -47,6 +47,7 @@ const init = () => {
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
formatter: (params: any) => { formatter: (params: any) => {
console.log('🚀 ~ init ~ params:', params)
if (!params || params.length === 0) return '' if (!params || params.length === 0) return ''
// 使用第一个项目的轴标签作为时间标题 // 使用第一个项目的轴标签作为时间标题
@@ -100,28 +101,33 @@ const initData = async (row: any) => {
} }
// 处理每条相位数据 // 处理每条相位数据
const seriesData = res.data.map((item: any) => { const seriesData = res.data
const values = xAxisData.map((time: string, index: number) => { .filter(item => item.valueType == 'max')
// 将传入的日期与时间拼接成完整的时间字符串 .sort((a, b) => {
const fullTime = `${row.time} ${time}` return a.phasic.localeCompare(b.phasic)
const value = parseFloat(item.value.split(',')[index]) || 0
return [fullTime, value]
}) })
.map((item: any) => {
const values = xAxisData.map((time: string, index: number) => {
// 将传入的日期与时间拼接成完整的时间字符串
const fullTime = `${row.time} ${time}`
const value = parseFloat(item.value.split(',')[index]) || 0
return [fullTime, value]
})
return { return {
name: `${item.phasic}`, name: `${item.phasic}`,
type: 'line', type: 'line',
showSymbol: false, showSymbol: false,
smooth: true, smooth: true,
data: values, data: values,
itemStyle: { itemStyle: {
normal: { normal: {
// 根据相位设置对应颜色 // 根据相位设置对应颜色
color: phaseColors[item.phasic] || config.layout.elementUiPrimary[0] color: phaseColors[item.phasic] || config.layout.elementUiPrimary[0]
}
} }
} }
} })
})
echartList.value.yAxis.max = max echartList.value.yAxis.max = max
echartList.value.yAxis.min = min echartList.value.yAxis.min = min
// 更新图表配置 // 更新图表配置
@@ -135,7 +141,7 @@ onMounted(() => {})
const open = async (row: any) => { const open = async (row: any) => {
dialogVisible.value = true dialogVisible.value = true
dialogTitle.value = row.name + '日趋势图' dialogTitle.value = row.name + '日趋势图'
dialogText.value = `监测点名称:${row.lineName}_越限时间:${row.time}_指标名称:${row.name}` dialogText.value = `监测点名称:${row.lineName} 越限时间:${row.time} 指标名称:${row.name}`
nextTick(() => { nextTick(() => {
initData(row) initData(row)
}) })

View File

@@ -6,7 +6,7 @@
:showReset="false" :showReset="false"
@selectChange="selectChange" @selectChange="selectChange"
datePicker datePicker
:timeKeyList="prop.timeKey" :timeKeyList="prop.timeKey"
v-if="fullscreen" v-if="fullscreen"
></TableHeader> ></TableHeader>
<my-echart <my-echart
@@ -39,7 +39,7 @@ const prop = defineProps({
h: { type: [String, Number] }, h: { type: [String, Number] },
width: { type: [String, Number] }, width: { type: [String, Number] },
height: { type: [String, Number] }, height: { type: [String, Number] },
timeKey: { type: Array as () => string[] }, timeKey: { type: Array as () => string[] },
timeValue: { type: Object }, timeValue: { type: Object },
interval: { type: Number } interval: { type: Number }
}) })
@@ -117,40 +117,24 @@ const tableStore: any = new TableStore({
title: '越限程度(%)', title: '越限程度(%)',
field: 'extent', field: 'extent',
minWidth: '70', minWidth: '70',
render: 'customTemplate', formatter: (row: any) => {
customTemplate: (row: any) => { return Math.floor(row.cellValue * 100) / 100
// 保留两个小数
const extentValue =
row.extent !== null && row.extent !== undefined && row.extent !== ''
? Math.floor(row.extent * 100) / 100
: '/'
return `<span>${extentValue}</span>`
} }
}, },
{ {
title: '越限时间', title: '越限时间',
field: 'time', field: 'time',
minWidth: '60', minWidth: '60',
render: 'customTemplate', formatter: (row: any) => {
customTemplate: (row: any) => { return row.cellValue || '/'
if (row.time !== null && row.time !== undefined && row.time !== '') {
return `<span>${row.time}</span>`
} else {
return `<span>/</span>`
}
} }
}, },
{ {
title: '越限最高监测点', title: '越限最高监测点',
field: 'lineName', field: 'lineName',
minWidth: '90', minWidth: '90',
render: 'customTemplate', formatter: (row: any) => {
customTemplate: (row: any) => { return row.cellValue || '/'
if (row.lineName !== null && row.lineName !== undefined && row.lineName !== '') {
return `<span>${row.lineName}</span>`
} else {
return `<span>/</span>`
}
} }
} }
], ],
@@ -159,7 +143,7 @@ const tableStore: any = new TableStore({
}, },
loadCallback: () => { loadCallback: () => {
// 定义 x 轴标签顺序 // 定义 x 轴标签顺序
const xAxisLabels = ['闪变', '谐波电压', '谐波电流', '电压偏差', '三相不平衡'] const xAxisLabels = ['长时闪变', '谐波电压', '谐波电流', '电压偏差', '三相不平衡']
// 根据指标名称顺序提取对应的 extent 数据 // 根据指标名称顺序提取对应的 extent 数据
const chartData = xAxisLabels.map(label => { const chartData = xAxisLabels.map(label => {
@@ -208,6 +192,7 @@ provide('tableStore', tableStore)
// 点击行 // 点击行
const cellClickEvent = ({ row, column }: any) => { const cellClickEvent = ({ row, column }: any) => {
dialogTrendChart.value = true dialogTrendChart.value = true
if (column.field == 'maxValue' && row.lineId) { if (column.field == 'maxValue' && row.lineId) {
nextTick(() => { nextTick(() => {
dailyTrendChartRef.value.open(row) dailyTrendChartRef.value.open(row)

View File

@@ -3,9 +3,9 @@
<!--治理效果报表 --> <!--治理效果报表 -->
<TableHeader :showReset="false" :timeKeyList="prop.timeKey" ref="TableHeaderRef" datePicker @selectChange="selectChange" v-if="fullscreen"> <TableHeader :showReset="false" :timeKeyList="prop.timeKey" ref="TableHeaderRef" datePicker @selectChange="selectChange" v-if="fullscreen">
<template v-slot:select> <template v-slot:select>
<el-form-item label="报表模板"> <el-form-item label="模板策略">
<el-select filterable v-model="tableStore.table.params.tempId" placeholder="请选择报表模板" clearable> <el-select filterable v-model="tableStore.table.params.tempId" placeholder="请选择模板策略" clearable>
<el-option v-for="item in templateList" :key="item.id" :label="item.name" :value="item.id" /> <el-option v-for="item in templateList" :key="item.id" :label="item.excelName" :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="监测对象"> <el-form-item label="监测对象">
@@ -34,10 +34,10 @@ import { ref, onMounted, provide, reactive, watch, h, computed, nextTick } from
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import { exportExcel } from '@/views/govern/reportForms/export.js' import { exportExcel } from '@/views/govern/reportForms/export.js'
import TableHeader from '@/components/table/header/index.vue' import TableHeader from '@/components/table/header/index.vue'
import { getTemplateList } from '@/api/harmonic-boot/luckyexcel' import { querySysExcel } from '@/api/harmonic-boot/luckyexcel'
import { getListByIds } from '@/api/harmonic-boot/cockpit/cockpit' import { getListByIds } from '@/api/harmonic-boot/cockpit/cockpit'
import { getTime } from '@/utils/formatTime' import { getTime } from '@/utils/formatTime'
import { ElMessage } from 'element-plus'
const prop = defineProps({ const prop = defineProps({
w: { type: [String, Number] }, w: { type: [String, Number] },
h: { type: [String, Number] }, h: { type: [String, Number] },
@@ -71,8 +71,8 @@ const initListByIds = () => {
} }
const templateListData = () => { const templateListData = () => {
getTemplateList({}).then(res => { querySysExcel({}).then(res => {
templateList.value = res.data.filter(item => item.name === '稳态治理报表') templateList.value = res.data.filter(item => item.excelType == 4)
if (!tableStore.table.params.tempId && templateList.value?.length > 0) { if (!tableStore.table.params.tempId && templateList.value?.length > 0) {
tableStore.table.params.tempId = templateList.value[0].id tableStore.table.params.tempId = templateList.value[0].id
} }
@@ -118,12 +118,15 @@ const tableStore: any = new TableStore({
column: [], column: [],
beforeSearchFun: () => { beforeSearchFun: () => {
setTime() setTime()
if (!tableStore.table.params.sensitiveUserId && idList.value?.length > 0) { // if (!tableStore.table.params.sensitiveUserId && idList.value?.length > 0) {
tableStore.table.params.sensitiveUserId = idList.value[0].id // tableStore.table.params.sensitiveUserId = idList.value[0].id
} // }
if (!tableStore.table.params.tempId && templateList.value?.length > 0) { // if (!tableStore.table.params.tempId && templateList.value?.length > 0) {
tableStore.table.params.tempId = templateList.value[0].id // tableStore.table.params.tempId = templateList.value[0].id
} // }
// if( !tableStore.table.params.tempId){
// return ElMessage.warning('请选择模板')
// }
}, },
loadCallback: () => { loadCallback: () => {
luckysheet.create({ luckysheet.create({

View File

@@ -34,7 +34,7 @@
</el-form-item> </el-form-item>
<el-form-item label="统计类型"> <el-form-item label="统计类型">
<el-select <el-select
style="min-width: 120px !important" style="min-width: 90px !important"
placeholder="请选择" placeholder="请选择"
v-model="searchForm.valueType" v-model="searchForm.valueType"
filterable filterable
@@ -42,7 +42,7 @@
<el-option value="max" label="最大值"></el-option> <el-option value="max" label="最大值"></el-option>
<el-option value="min" label="最小值"></el-option> <el-option value="min" label="最小值"></el-option>
<el-option value="avg" label="平均值"></el-option> <el-option value="avg" label="平均值"></el-option>
<el-option value="cp95" label="cp95"></el-option> <el-option value="cp95" label="CP95"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@@ -66,7 +66,7 @@
<el-option <el-option
v-for="vv in item.countOptions" v-for="vv in item.countOptions"
:key="vv" :key="vv"
:label="vv" :label="item.name.includes('间谐波') ? vv - 0.5 : vv"
:value="vv" :value="vv"
></el-option> ></el-option>
</el-select> </el-select>
@@ -82,11 +82,7 @@
</TableHeader> </TableHeader>
</div> </div>
<div class="history_chart" :style="pageHeight" v-loading="loading"> <div class="history_chart" :style="pageHeight" v-loading="loading">
<MyEchart <MyEchart ref="historyChart" :options="echartsData" v-if="showEchart" />
ref="historyChart"
:options="echartsData"
v-if="showEchart"
/>
<el-empty :style="pageHeight" v-else description="暂无数据" /> <el-empty :style="pageHeight" v-else description="暂无数据" />
</div> </div>
</el-dialog> </el-dialog>
@@ -160,28 +156,40 @@ const countOptions: any = ref([])
const legendDictList: any = ref([]) const legendDictList: any = ref([])
const initCode = (field: string, title: string) => { const initCode = (field: string, title: string) => {
queryByCode('steady_state_limit_trend').then(res => { queryByCode('gridSide_exceedTheLimit').then(res => {
queryCsDictTree(res.data.id).then(item => { queryCsDictTree(res.data.id).then(item => {
//排序 //排序
indexOptions.value = item.data.sort((a: any, b: any) => { indexOptions.value = item.data.sort((a: any, b: any) => {
return a.sort - b.sort return a.sort - b.sort
}) })
const titleMap: Record<string, number> = { let codeKey = field.includes('flickerOvertime')
flickerOvertime: 0, ? '闪变'
uaberranceOvertime: 3, : field.includes('uharm')
ubalanceOvertime: 4, ? '谐波电压'
freqDevOvertime: 5 : field.includes('iharm')
} ? '谐波电流'
: field.includes('voltageDevOvertime')
? '电压偏差'
: field.includes('ubalanceOvertime')
? '不平衡'
: ''
let defaultIndex = 0 // 默认值 // const titleMap: Record<string, number> = {
// flickerOvertime: 0,
// uaberranceOvertime: 3,
// ubalanceOvertime: 4,
// freqDevOvertime: 5
// }
if (field in titleMap) { // let defaultIndex = 0 // 默认值
defaultIndex = titleMap[field] let defaultIndex = indexOptions.value.findIndex((item: any) => item.name.includes(codeKey)) || 0
} else if (field.includes('uharm')) { // if (field in titleMap) {
defaultIndex = 1 // defaultIndex = titleMap[field]
} else if (field.includes('iharm')) { // } else if (field.includes('uharm')) {
defaultIndex = 2 // defaultIndex = indexOptions.value.findIndex((item: any) => item.code === 'uharm')
} // } else if (field.includes('iharm')) {
// defaultIndex = indexOptions.value.findIndex((item: any) => item.code === 'iharm')
// }
searchForm.value.index[0] = indexOptions.value[defaultIndex].id searchForm.value.index[0] = indexOptions.value[defaultIndex].id
}) })
@@ -205,7 +213,7 @@ const initCode = (field: string, title: string) => {
if (kk.harmStart && kk.harmEnd) { if (kk.harmStart && kk.harmEnd) {
range(0, 0, 0) range(0, 0, 0)
if (kk.showName == '间谐波电压含有率') { if (kk.showName.includes('间谐波电压')) {
countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1).map( countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1).map(
(item: any) => { (item: any) => {
return item - 0.5 return item - 0.5
@@ -287,14 +295,15 @@ const init = async () => {
let lists: any = [] let lists: any = []
let frequencys: any = null let frequencys: any = null
countData.value.map((item: any, index: any) => { countData.value.map((item: any, index: any) => {
if (item.name.includes('谐波含有率')) { if (item.name.includes('谐波')) {
frequencys = item.count frequencys = item.count
} else { } else {
frequencys = '' frequencys = ''
} }
lists[index] = { lists[index] = {
statisticalId: item.index, statisticalId: item.index,
frequency: frequencys !== null && frequencys !== undefined ? String(frequencys) : '' frequency: frequencys !== null && frequencys !== undefined ? String(frequencys) : ''
} }
}) })
let obj = { let obj = {
@@ -600,12 +609,12 @@ const formatCountOptions = () => {
}) })
countData.value.map((item: any, key: any) => { countData.value.map((item: any, key: any) => {
if (item.name == '谐波电流有效值') { if (item.name.includes('谐波电压')) {
item.name = '谐波电流次数'
} else if (item.name == '谐波电压含有率') {
item.name = '谐波电压次数'
} else if (item.name == '间谐波电压含有率') {
item.name = '间谐波电压次数' item.name = '间谐波电压次数'
} else if (item.name.includes('谐波电流')) {
item.name = '谐波电流次数'
} else if (item.name.includes('谐波电压')) {
item.name = '谐波电压次数'
} }
}) })
} }

View File

@@ -14,7 +14,7 @@
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.lineId" :key="item.lineId"
:label="item.name" :label="item.lineName"
:value="item.lineId" :value="item.lineId"
/> />
</el-select> </el-select>
@@ -85,7 +85,7 @@ const tableStore: any = new TableStore({
width: '150' width: '150'
}, },
{ {
title: '闪变越限(%)', title: '长时闪变越限(%)',
field: 'flickerOvertime', field: 'flickerOvertime',
width: '90', width: '90',
render: 'customTemplate', render: 'customTemplate',
@@ -101,16 +101,7 @@ const tableStore: any = new TableStore({
title: '谐波电流越限(%)', title: '谐波电流越限(%)',
children: loop50('iharm') children: loop50('iharm')
}, },
{ {
title: '三相不平衡度越限(%)',
field: 'ubalanceOvertime',
width: '100',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.ubalanceOvertime}</span>`
}
},
{
title: '电压偏差越限(%)', title: '电压偏差越限(%)',
field: 'voltageDevOvertime', field: 'voltageDevOvertime',
width: '100', width: '100',
@@ -120,14 +111,24 @@ const tableStore: any = new TableStore({
} }
}, },
{ {
title: '频率偏差越限(%)', title: '三相不平衡度越限(%)',
field: 'freqDevOvertime', field: 'ubalanceOvertime',
width: '100', width: '100',
render: 'customTemplate', render: 'customTemplate',
customTemplate: (row: any) => { customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.freqDevOvertime}</span>` return `<span style='cursor: pointer;text-decoration: underline;'>${row.ubalanceOvertime}</span>`
} }
} },
// {
// title: '频率偏差越限(%)',
// field: 'freqDevOvertime',
// width: '100',
// render: 'customTemplate',
// customTemplate: (row: any) => {
// return `<span style='cursor: pointer;text-decoration: underline;'>${row.freqDevOvertime}</span>`
// }
// }
], ],
beforeSearchFun: () => { beforeSearchFun: () => {
}, },
@@ -139,16 +140,20 @@ const tableStore: any = new TableStore({
provide('tableStore', tableStore) provide('tableStore', tableStore)
tableStore.table.params.sortBy = '' tableStore.table.params.sortBy = ''
tableStore.table.params.orderBy = '' tableStore.table.params.orderBy = ''
const open = async (row: any,searchBeginTime:any,searchEndTime:any) => { const open = async (row: any,searchBeginTime:any,searchEndTime:any,interval:any,list:any) => {
dialogVisible.value = true dialogVisible.value = true
initCSlineList() options.value = list
// initCSlineList()
tableStore.table.params.lineId = row.lineId tableStore.table.params.lineId = row.lineId
nextTick(() => { nextTick(() => {
tableHeaderRef.value.setTimeInterval([searchBeginTime, searchEndTime]) tableHeaderRef.value.setInterval(interval)
setTimeout(() => {
tableHeaderRef.value.setTimeInterval([searchBeginTime, searchEndTime])
tableStore.table.params.searchBeginTime =searchBeginTime tableStore.table.params.searchBeginTime =searchBeginTime
tableStore.table.params.searchEndTime = searchEndTime tableStore.table.params.searchEndTime = searchEndTime
tableStore.index() tableStore.index()
},100)
}) })
} }

View File

@@ -5,7 +5,8 @@
:showReset="false" :showReset="false"
ref="TableHeaderRef" ref="TableHeaderRef"
@selectChange="selectChange" @selectChange="selectChange"
datePicker :timeKeyList="prop.timeKey" datePicker
:timeKeyList="prop.timeKey"
v-if="fullscreen" v-if="fullscreen"
></TableHeader> ></TableHeader>
<my-echart <my-echart
@@ -41,7 +42,7 @@ const prop = defineProps({
h: { type: [String, Number] }, h: { type: [String, Number] },
width: { type: [String, Number] }, width: { type: [String, Number] },
height: { type: [String, Number] }, height: { type: [String, Number] },
timeKey: { type: Array as () => string[] }, timeKey: { type: Array as () => string[] },
timeValue: { type: Object }, timeValue: { type: Object },
interval: { type: Number } interval: { type: Number }
}) })
@@ -87,7 +88,7 @@ const initEcharts = () => {
xAxis: { xAxis: {
// name: '(区域)', // name: '(区域)',
data: ['闪变', '谐波电压', '谐波电流', '电压偏差', '三相不平衡'] data: ['长时闪变', '谐波电压', '谐波电流', '电压偏差', '三相不平衡']
}, },
yAxis: { yAxis: {
@@ -148,7 +149,7 @@ const tableStore: any = new TableStore({
title: '越限占比(%)', title: '越限占比(%)',
children: [ children: [
{ {
title: '闪变', title: '长时闪变',
field: 'flicker', field: 'flicker',
minWidth: '70', minWidth: '70',
render: 'customTemplate', render: 'customTemplate',
@@ -197,6 +198,7 @@ const tableStore: any = new TableStore({
], ],
beforeSearchFun: () => { beforeSearchFun: () => {
setTime() setTime()
tableStore.table.params.interval = TableHeaderRef.value?.datePickerRef?.interval || 3
}, },
loadCallback: () => { loadCallback: () => {
tableStore.table.height = `calc(${prop.height} - 80px)` tableStore.table.height = `calc(${prop.height} - 80px)`
@@ -211,13 +213,13 @@ provide('tableStore', tableStore)
// 点击行 // 点击行
const cellClickEvent = ({ row, column }: any) => { const cellClickEvent = ({ row, column }: any) => {
if (column.field != 'name') { OverLimitDetailsRef.value.open(
OverLimitDetailsRef.value.open( row,
row, tableStore.table.params.searchBeginTime || prop.timeValue?.[0],
tableStore.table.params.searchBeginTime || prop.timeValue?.[0], tableStore.table.params.searchEndTime || prop.timeValue?.[1],
tableStore.table.params.searchEndTime || prop.timeValue?.[1] tableStore.table.params.interval || prop.interval,
) tableStore.table.data
} )
} }
onMounted(() => { onMounted(() => {

View File

@@ -2,7 +2,14 @@
<div> <div>
<!--指标越限时间分布 <!--指标越限时间分布
--> -->
<TableHeader :showReset="false" :timeKeyList="prop.timeKey" ref="TableHeaderRef" @selectChange="selectChange" datePicker v-if="fullscreen"> <TableHeader
:showReset="false"
:timeKeyList="prop.timeKey"
ref="TableHeaderRef"
@selectChange="selectChange"
datePicker
v-if="fullscreen"
>
<template v-slot:select> <template v-slot:select>
<el-form-item label="监测点"> <el-form-item label="监测点">
<el-select size="small" filterable v-model="tableStore.table.params.lineId"> <el-select size="small" filterable v-model="tableStore.table.params.lineId">
@@ -19,10 +26,19 @@
<div v-loading="tableStore.table.loading"> <div v-loading="tableStore.table.loading">
<my-echart <my-echart
class="tall" class="tall"
v-if="lineShow"
:options="echartList1" :options="echartList1"
:style="{ :style="{
width: prop.width, width: prop.width,
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px)` height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px)`
}"
/>
<el-empty
v-else
description="暂无监测点"
:style="{
width: prop.width,
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px)`
}" }"
/> />
<!-- <my-echart <!-- <my-echart
@@ -49,7 +65,7 @@ const prop = defineProps({
h: { type: [String, Number] }, h: { type: [String, Number] },
width: { type: [String, Number] }, width: { type: [String, Number] },
height: { type: [String, Number] }, height: { type: [String, Number] },
timeKey: { type: Array as () => string[] }, timeKey: { type: Array as () => string[] },
timeValue: { type: Object }, timeValue: { type: Object },
interval: { type: Number } interval: { type: Number }
}) })
@@ -61,7 +77,7 @@ const lineList = ref()
const headerHeight = ref(57) const headerHeight = ref(57)
const TableHeaderRef = ref() const TableHeaderRef = ref()
const lineShow = ref(true)
const selectChange = (showSelect: any, height: any, datePickerValue?: any) => { const selectChange = (showSelect: any, height: any, datePickerValue?: any) => {
headerHeight.value = height headerHeight.value = height
@@ -92,6 +108,11 @@ const probabilityData = ref()
const initLineList = async () => { const initLineList = async () => {
cslineList({}).then(res => { cslineList({}).then(res => {
if (res.data.length == 0) {
lineShow.value = false
return (tableStore.table.loading = false)
}
lineShow.value = true
lineList.value = res.data lineList.value = res.data
tableStore.table.params.lineId = lineList.value[0].lineId tableStore.table.params.lineId = lineList.value[0].lineId
tableStore.index() tableStore.index()
@@ -115,7 +136,7 @@ const initProbabilityData = () => {
// 处理接口返回的数据,转换为图表所需格式 // 处理接口返回的数据,转换为图表所需格式
if (res.data && Array.isArray(res.data)) { if (res.data && Array.isArray(res.data)) {
// 定义指标类型顺序 // 定义指标类型顺序
const indicatorOrder = ['闪变', '谐波电压', '谐波电流', '电压偏差', '三相电压不平衡度', '频率偏差'] const indicatorOrder = ['长时闪变', '谐波电压', '谐波电流', '电压偏差', '三相电压不平衡度', '频率偏差']
// 按照指定顺序排序数据 // 按照指定顺序排序数据
const sortedData = [...res.data].sort((a, b) => { const sortedData = [...res.data].sort((a, b) => {
return indicatorOrder.indexOf(a.indexName) - indicatorOrder.indexOf(b.indexName) return indicatorOrder.indexOf(a.indexName) - indicatorOrder.indexOf(b.indexName)
@@ -146,6 +167,9 @@ const initProbabilityData = () => {
const yAxisData = sortedData.map(item => item.indexName) const yAxisData = sortedData.map(item => item.indexName)
echartList.value = { echartList.value = {
title: {
text: '指标越限概率分布'
},
options: { options: {
backgroundColor: '#fff', backgroundColor: '#fff',
tooltip: { tooltip: {
@@ -166,14 +190,7 @@ const initProbabilityData = () => {
return tips return tips
} }
}, },
title: {
text: '指标越限概率分布',
x: 'center',
textStyle: {
fontSize: 16,
fontWeight: 'normal'
}
},
// 移除或隐藏 visualMap 组件 // 移除或隐藏 visualMap 组件
visualMap: { visualMap: {
show: false, // 设置为 false 隐藏右侧颜色条 show: false, // 设置为 false 隐藏右侧颜色条

View File

@@ -1,7 +1,14 @@
<template> <template>
<div> <div>
<!--指标越限概率分布 --> <!--指标越限概率分布 -->
<TableHeader :showReset="false" :timeKeyList="prop.timeKey" ref="TableHeaderRef" @selectChange="selectChange" datePicker v-if="fullscreen"> <TableHeader
:showReset="false"
:timeKeyList="prop.timeKey"
ref="TableHeaderRef"
@selectChange="selectChange"
datePicker
v-if="fullscreen"
>
<template v-slot:select> <template v-slot:select>
<el-form-item label="监测点"> <el-form-item label="监测点">
<el-select size="small" filterable v-model="tableStore.table.params.lineId"> <el-select size="small" filterable v-model="tableStore.table.params.lineId">
@@ -17,11 +24,20 @@
</TableHeader> </TableHeader>
<div v-loading="tableStore.table.loading"> <div v-loading="tableStore.table.loading">
<my-echart <my-echart
v-if="lineShow"
class="tall" class="tall"
:options="echartList" :options="echartList"
:style="{ :style="{
width: prop.width, width: prop.width,
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px)` height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px)`
}"
/>
<el-empty
v-else
description="暂无监测点"
:style="{
width: prop.width,
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px)`
}" }"
/> />
<!-- <my-echart <!-- <my-echart
@@ -48,11 +64,11 @@ const prop = defineProps({
h: { type: [String, Number] }, h: { type: [String, Number] },
width: { type: [String, Number] }, width: { type: [String, Number] },
height: { type: [String, Number] }, height: { type: [String, Number] },
timeKey: { type: Array as () => string[] }, timeKey: { type: Array as () => string[] },
timeValue: { type: Object }, timeValue: { type: Object },
interval: { type: Number } interval: { type: Number }
}) })
const lineShow = ref(true)
// const options = ref(JSON.parse(window.localStorage.getItem('lineIdList') || '[]')) // const options = ref(JSON.parse(window.localStorage.getItem('lineIdList') || '[]'))
const lineList = ref() const lineList = ref()
@@ -91,6 +107,11 @@ const probabilityData = ref()
const initLineList = async () => { const initLineList = async () => {
cslineList({}).then(res => { cslineList({}).then(res => {
if (res.data.length == 0) {
lineShow.value = false
return (tableStore.table.loading = false)
}
lineShow.value = true
lineList.value = res.data lineList.value = res.data
tableStore.table.params.lineId = lineList.value[0].lineId tableStore.table.params.lineId = lineList.value[0].lineId
tableStore.index() tableStore.index()
@@ -114,7 +135,7 @@ const initProbabilityData = () => {
// 处理接口返回的数据,转换为图表所需格式 // 处理接口返回的数据,转换为图表所需格式
if (res.data && Array.isArray(res.data)) { if (res.data && Array.isArray(res.data)) {
// 定义指标类型顺序 // 定义指标类型顺序
const indicatorOrder = ['闪变', '谐波电压', '谐波电流', '电压偏差', '三相电压不平衡度', '频率偏差'] const indicatorOrder = ['长时闪变', '谐波电压', '谐波电流', '电压偏差', '三相电压不平衡度', '频率偏差']
// 按照指定顺序排序数据 // 按照指定顺序排序数据
const sortedData = [...res.data].sort((a, b) => { const sortedData = [...res.data].sort((a, b) => {
return indicatorOrder.indexOf(a.indexName) - indicatorOrder.indexOf(b.indexName) return indicatorOrder.indexOf(a.indexName) - indicatorOrder.indexOf(b.indexName)
@@ -145,6 +166,9 @@ const initProbabilityData = () => {
const yAxisData = sortedData.map(item => item.indexName) const yAxisData = sortedData.map(item => item.indexName)
echartList.value = { echartList.value = {
title: {
text: '指标越限概率分布'
},
options: { options: {
backgroundColor: '#fff', backgroundColor: '#fff',
tooltip: { tooltip: {
@@ -165,14 +189,7 @@ const initProbabilityData = () => {
return tips return tips
} }
}, },
title: {
text: '指标越限概率分布',
x: 'center',
textStyle: {
fontSize: 16,
fontWeight: 'normal'
}
},
// 移除或隐藏 visualMap 组件 // 移除或隐藏 visualMap 组件
visualMap: { visualMap: {
show: false, // 设置为 false 隐藏右侧颜色条 show: false, // 设置为 false 隐藏右侧颜色条

View File

@@ -66,7 +66,7 @@
<el-option <el-option
v-for="vv in item.countOptions" v-for="vv in item.countOptions"
:key="vv" :key="vv"
:label="vv" :label="item.name.includes('间谐波') ? vv - 0.5 : vv"
:value="vv" :value="vv"
></el-option> ></el-option>
</el-select> </el-select>
@@ -81,12 +81,8 @@
</template> </template>
</TableHeader> </TableHeader>
</div> </div>
<div class="history_chart" :style="pageHeight" v-loading="loading"> <div class="history_chart" :style="pageHeight" v-loading="loading">
<MyEchart <MyEchart ref="historyChart" :options="echartsData" v-if="showEchart" />
ref="historyChart"
:options="echartsData"
v-if="showEchart"
/>
<el-empty :style="pageHeight" v-else description="暂无数据" /> <el-empty :style="pageHeight" v-else description="暂无数据" />
</div> </div>
</el-dialog> </el-dialog>
@@ -160,28 +156,40 @@ const countOptions: any = ref([])
const legendDictList: any = ref([]) const legendDictList: any = ref([])
const initCode = (field: string, title: string) => { const initCode = (field: string, title: string) => {
queryByCode('steady_state_limit_trend').then(res => { queryByCode('gridSide_exceedTheLimit').then(res => {
queryCsDictTree(res.data.id).then(item => { queryCsDictTree(res.data.id).then(item => {
//排序 //排序
indexOptions.value = item.data.sort((a: any, b: any) => { indexOptions.value = item.data.sort((a: any, b: any) => {
return a.sort - b.sort return a.sort - b.sort
}) })
const titleMap: Record<string, number> = { // const titleMap: Record<string, number> = {
flickerOvertime: 0, // flickerOvertime: 0,
uaberranceOvertime: 3, // uaberranceOvertime: 3,
ubalanceOvertime: 4, // ubalanceOvertime: 4,
freqDevOvertime: 5 // freqDevOvertime: 5
} // }
let defaultIndex = 0 // 默认值 // let defaultIndex = 0 // 默认值
if (field in titleMap) { // if (field in titleMap) {
defaultIndex = titleMap[field] // defaultIndex = titleMap[field]
} else if (field.includes('uharm')) { // } else if (field.includes('uharm')) {
defaultIndex = 1 // defaultIndex = 1
} else if (field.includes('iharm')) { // } else if (field.includes('iharm')) {
defaultIndex = 2 // defaultIndex = 2
} // }
let codeKey = field.includes('flickerOvertime')
? '闪变'
: field.includes('uharm')
? '谐波电压'
: field.includes('iharm')
? '谐波电流'
: field.includes('voltageDevOvertime')
? '电压偏差'
: field.includes('ubalanceOvertime')
? '不平衡'
: ''
let defaultIndex = indexOptions.value.findIndex((item: any) => item.name.includes(codeKey)) || 0
searchForm.value.index[0] = indexOptions.value[defaultIndex].id searchForm.value.index[0] = indexOptions.value[defaultIndex].id
}) })
@@ -294,7 +302,7 @@ const init = async () => {
} }
lists[index] = { lists[index] = {
statisticalId: item.index, statisticalId: item.index,
frequency: frequencys !== null && frequencys !== undefined ? String(frequencys) : '' frequency: frequencys !== null && frequencys !== undefined ? String(frequencys) : ''
} }
}) })
let obj = { let obj = {
@@ -579,7 +587,6 @@ const setTimeControl = () => {
} }
const selectChange = (flag: boolean, height: any) => { const selectChange = (flag: boolean, height: any) => {
pageHeight.value = mainHeight(height * 1.6, 1.6) pageHeight.value = mainHeight(height * 1.6, 1.6)
} }
//导出 //导出

View File

@@ -14,7 +14,7 @@
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.lineId" :key="item.lineId"
:label="item.name" :label="item.lineName"
:value="item.lineId" :value="item.lineId"
/> />
</el-select> </el-select>
@@ -24,11 +24,7 @@
<Table ref="tableRef" @cell-click="cellClickEvent" isGroup :height="height"></Table> <Table ref="tableRef" @cell-click="cellClickEvent" isGroup :height="height"></Table>
</el-dialog> </el-dialog>
<!-- 谐波电流谐波电压占有率 --> <!-- 谐波电流谐波电压占有率 -->
<HarmonicRatio <HarmonicRatio ref="harmonicRatioRef" @close="onHarmonicRatioClose" v-if="dialogFlag" />
ref="harmonicRatioRef"
@close="onHarmonicRatioClose"
v-if="dialogFlag"
/>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -90,7 +86,7 @@ const tableStore: any = new TableStore({
width: '150' width: '150'
}, },
{ {
title: '闪变越限(分钟)', title: '越限(分钟)',
field: 'flickerOvertime', field: 'flickerOvertime',
width: '90', width: '90',
render: 'customTemplate', render: 'customTemplate',
@@ -105,6 +101,14 @@ const tableStore: any = new TableStore({
{ {
title: '谐波电流越限(分钟)', title: '谐波电流越限(分钟)',
children: loop50('iharm') children: loop50('iharm')
}, {
title: '电压偏差越限(分钟)',
field: 'uaberranceOvertime',
width: '100',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.uaberranceOvertime}</span>`
}
}, },
{ {
title: '三相不平衡度越限(分钟)', title: '三相不平衡度越限(分钟)',
@@ -115,24 +119,16 @@ const tableStore: any = new TableStore({
return `<span style='cursor: pointer;text-decoration: underline;'>${row.ubalanceOvertime}</span>` return `<span style='cursor: pointer;text-decoration: underline;'>${row.ubalanceOvertime}</span>`
} }
}, },
{
title: '电压偏差越限(分钟)', // {
field: 'uaberranceOvertime', // title: '频率偏差越限(分钟)',
width: '100', // field: 'freqDevOvertime',
render: 'customTemplate', // width: '100',
customTemplate: (row: any) => { // render: 'customTemplate',
return `<span style='cursor: pointer;text-decoration: underline;'>${row.uaberranceOvertime}</span>` // customTemplate: (row: any) => {
} // return `<span style='cursor: pointer;text-decoration: underline;'>${row.freqDevOvertime}</span>`
}, // }
{ // }
title: '频率偏差越限(分钟)',
field: 'freqDevOvertime',
width: '100',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.freqDevOvertime}</span>`
}
}
], ],
beforeSearchFun: () => { beforeSearchFun: () => {
}, },
@@ -144,9 +140,10 @@ const tableStore: any = new TableStore({
provide('tableStore', tableStore) provide('tableStore', tableStore)
tableStore.table.params.sortBy = '' tableStore.table.params.sortBy = ''
tableStore.table.params.orderBy = '' tableStore.table.params.orderBy = ''
const open = async (row: any,searchBeginTime:any,searchEndTime:any) => { const open = async (row: any,searchBeginTime:any,searchEndTime:any,data:any=[]) => {
dialogVisible.value = true dialogVisible.value = true
initCSlineList() // initCSlineList()
options.value = data
tableStore.table.params.lineId = row.lineId tableStore.table.params.lineId = row.lineId
nextTick(() => { nextTick(() => {
@@ -180,8 +177,8 @@ const onHarmonicRatioClose = () => {
} }
const initCSlineList = async () => { const initCSlineList = async () => {
const res = await cslineList({}) // const res = await cslineList({})
options.value = res.data // options.value = res.data
} }

View File

@@ -1,10 +1,17 @@
<template> <template>
<div> <div>
<!--主要监测点列表 --> <!--主要监测点列表 -->
<TableHeader :showReset="false" :timeKeyList="prop.timeKey" @selectChange="selectChange" v-if="fullscreen" datePicker ref="TableHeaderRef"> <TableHeader
:showReset="false"
:timeKeyList="prop.timeKey"
@selectChange="selectChange"
v-if="fullscreen"
ref="TableHeaderRef"
>
<template v-slot:select> <template v-slot:select>
<el-form-item label="关键"> <el-form-item label="关键字筛选">
<el-input v-model="tableStore.table.params.keywords" clearable placeholder="请输关键字" /> <el-input v-model="tableStore.table.params.keywords" clearable placeholder="请输入监测点名称" />
</el-form-item> </el-form-item>
</template> </template>
</TableHeader> </TableHeader>
@@ -22,7 +29,7 @@ import { ref, onMounted, provide, reactive, watch, nextTick } from 'vue'
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue' import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue' import TableHeader from '@/components/table/header/index.vue'
import { getTime } from '@/utils/formatTime' import { getTimeOfTheMonth } from '@/utils/formatTime'
import OverLimitDetails from '@/components/cockpit/indicatorFittingChart/components/overLimitDetails.vue' import OverLimitDetails from '@/components/cockpit/indicatorFittingChart/components/overLimitDetails.vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { useTimeCacheStore } from '@/stores/timeCache' import { useTimeCacheStore } from '@/stores/timeCache'
@@ -32,7 +39,7 @@ const prop = defineProps({
h: { type: [String, Number] }, h: { type: [String, Number] },
width: { type: [String, Number] }, width: { type: [String, Number] },
height: { type: [String, Number] }, height: { type: [String, Number] },
timeKey: { type: Array as () => string[] }, timeKey: { type: Array as () => string[] },
timeValue: { type: Object }, timeValue: { type: Object },
interval: { type: Number } interval: { type: Number }
}) })
@@ -59,11 +66,11 @@ const fullscreen = computed(() => {
const selectChange = (showSelect: any, height: any, datePickerValue?: any) => { const selectChange = (showSelect: any, height: any, datePickerValue?: any) => {
headerHeight.value = height headerHeight.value = height
if (datePickerValue && datePickerValue.timeValue) { // if (datePickerValue && datePickerValue.timeValue) {
// 更新时间参数 // // 更新时间参数
tableStore.table.params.searchBeginTime = datePickerValue.timeValue[0] // tableStore.table.params.searchBeginTime = datePickerValue.timeValue[0]
tableStore.table.params.searchEndTime = datePickerValue.timeValue[1] // tableStore.table.params.searchEndTime = datePickerValue.timeValue[1]
} // }
} }
const tableStore: any = new TableStore({ const tableStore: any = new TableStore({
@@ -93,18 +100,24 @@ const tableStore: any = new TableStore({
{ {
title: '监测对象类型', title: '监测对象类型',
field: 'objType', field: 'objType',
minWidth: '90' minWidth: '90',
formatter: (row: any) => {
return row.cellValue || '/'
}
}, },
{ {
title: '是否治理', title: '是否治理',
field: 'govern', field: 'govern',
minWidth: '70' minWidth: '80',
formatter: (row: any) => {
return row.cellValue || '/'
}
}, },
{ title: '主要存在的电能质量问题', field: 'problems', minWidth: '150', showOverflow: true } { title: '主要存在的电能质量问题', field: 'problems', minWidth: '150', showOverflow: true }
], ],
beforeSearchFun: () => { beforeSearchFun: () => {
setTime() setTime()
}, },
loadCallback: () => { loadCallback: () => {
tableStore.table.height = `calc(${prop.height} - 80px)` tableStore.table.height = `calc(${prop.height} - 80px)`
@@ -119,31 +132,34 @@ provide('tableStore', tableStore)
// 点击行 // 点击行
const cellClickEvent = ({ row, column }: any) => { const cellClickEvent = ({ row, column }: any) => {
if (column.field == 'lineName') { if (column.field == 'lineName') {
let time = getTimeOfTheMonth('3');
OverLimitDetailsRef.value.open( OverLimitDetailsRef.value.open(
row, row,
tableStore.table.params.searchBeginTime || prop.timeValue?.[0], time[0],
tableStore.table.params.searchEndTime || prop.timeValue?.[1] time[1],
tableStore.table.data
) )
} }
} }
const setTime = () => { const setTime = () => {
const time = getTime( // const time = getTime(
(TableHeaderRef.value?.datePickerRef.interval || prop.interval) ?? 0, // (TableHeaderRef.value?.datePickerRef.interval || prop.interval) ?? 0,
prop.timeKey, // prop.timeKey,
fullscreen.value // fullscreen.value
? [tableStore.table.params.searchBeginTime, tableStore.table.params.searchEndTime] // ? [tableStore.table.params.searchBeginTime, tableStore.table.params.searchEndTime]
: prop.timeValue // : prop.timeValue
) // )
if (Array.isArray(time)) { // if (Array.isArray(time)) {
tableStore.table.params.searchBeginTime = time[0] // tableStore.table.params.searchBeginTime = time[0]
tableStore.table.params.searchEndTime = time[1] // tableStore.table.params.searchEndTime = time[1]
// TableHeaderRef.value?.setInterval(time[2] - 0) // // TableHeaderRef.value?.setInterval(time[2] - 0)
// TableHeaderRef.value?.setTimeInterval([time[0], time[1]]) // // TableHeaderRef.value?.setTimeInterval([time[0], time[1]])
} else { // } else {
console.warn('获取时间失败time 不是一个有效数组') // console.warn('获取时间失败time 不是一个有效数组')
} // }
} }
// 在组件挂载时设置缓存值到 DatePicker // 在组件挂载时设置缓存值到 DatePicker

View File

@@ -69,7 +69,7 @@ const tableStore: any = new TableStore({
width: '150' width: '150'
}, },
{ {
title: '闪变越限(分钟)', title: '长时闪变越限(分钟)',
field: 'flicker', field: 'flicker',
width: '80' width: '80'
}, },
@@ -99,26 +99,7 @@ const tableStore: any = new TableStore({
], ],
beforeSearchFun: () => {}, beforeSearchFun: () => {},
loadCallback: () => { loadCallback: () => {
tableStore.table.data = [
{
time: '2024-01-01 00:00:00',
name: '35kV进线',
flicker: '0',
},
{
time: '2024-01-01 00:00:00',
name: '35kV进线',
flicker: '0',
},
{
time: '2024-01-01 00:00:00',
name: '35kV进线',
flicker: '0',
},
]
} }
}) })

View File

@@ -84,7 +84,7 @@ const tableStore: any = new TableStore({
width: '150' width: '150'
}, },
{ {
title: '闪变越限(分钟)', title: '长时闪变越限(分钟)',
field: 'flicker', field: 'flicker',
width: '80', width: '80',
render: 'customTemplate', render: 'customTemplate',

View File

@@ -5,7 +5,7 @@
datePicker datePicker
@selectChange="selectChange" @selectChange="selectChange"
v-if="fullscreen" v-if="fullscreen"
ref="TableHeaderRef" ref="TableHeaderRef"
:timeKeyList="prop.timeKey" :timeKeyList="prop.timeKey"
> >
<template v-slot:select> <template v-slot:select>
@@ -75,12 +75,21 @@
<div v-loading="tableStore.table.loading"> <div v-loading="tableStore.table.loading">
<my-echart <my-echart
class="tall" class="tall"
v-if="lineShow"
:options="echartList" :options="echartList"
:style="{ :style="{
width: prop.width, width: prop.width,
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px )` height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px )`
}" }"
/> />
<el-empty
v-else
description="暂无监测点"
:style="{
width: prop.width,
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px)`
}"
/>
</div> </div>
</div> </div>
</template> </template>
@@ -100,7 +109,7 @@ const prop = defineProps({
h: { type: [String, Number] }, h: { type: [String, Number] },
width: { type: [String, Number] }, width: { type: [String, Number] },
height: { type: [String, Number] }, height: { type: [String, Number] },
timeKey: { type: Array as () => string[] }, timeKey: { type: Array as () => string[] },
timeValue: { type: Object }, timeValue: { type: Object },
interval: { type: Number } interval: { type: Number }
}) })
@@ -114,7 +123,7 @@ const lineList: any = ref()
const powerList: any = ref() const powerList: any = ref()
const chartsList = ref<any>([]) const chartsList = ref<any>([])
const lineShow = ref(true)
// 计算是否全屏展示 // 计算是否全屏展示
const fullscreen = computed(() => { const fullscreen = computed(() => {
const w = Number(prop.w) const w = Number(prop.w)
@@ -141,8 +150,14 @@ const indicatorList = ref()
const initLineList = async () => { const initLineList = async () => {
cslineList({}).then(res => { cslineList({}).then(res => {
if (res.data.length == 0) {
lineShow.value = false
return (tableStore.table.loading = false)
}
lineShow.value = true
lineList.value = res.data lineList.value = res.data
tableStore.table.params.lineId = lineList.value[0].lineId tableStore.table.params.lineId = lineList.value[0].lineId
initCode()
}) })
} }
@@ -171,7 +186,7 @@ const setEchart = () => {
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
formatter: function (params: any) { formatter: function (params: any) {
let result = params[0].name let result = params[0].axisValueLabel
params.forEach((item: any) => { params.forEach((item: any) => {
if (item.seriesName === indicatorName) { if (item.seriesName === indicatorName) {
// 对于电能质量指标格式化Y轴值显示 // 对于电能质量指标格式化Y轴值显示
@@ -186,7 +201,7 @@ const setEchart = () => {
result += `<br/>${item.marker}${item.seriesName}: ${valueText}` result += `<br/>${item.marker}${item.seriesName}: ${valueText}`
} else { } else {
// 对于功率数据,正常显示数值 // 对于功率数据,正常显示数值
result += `<br/>${item.marker}${item.seriesName}: ${item.value[1]}` result += `<br/>${item.marker}${item.seriesName}: ${item.value[1]} ${item.value[2]}`
} }
}) })
return result return result
@@ -277,7 +292,8 @@ const setEchart = () => {
item.time, item.time,
item.statisticalData !== null && item.statisticalData !== undefined item.statisticalData !== null && item.statisticalData !== undefined
? parseFloat(item.statisticalData.toFixed(2)) ? parseFloat(item.statisticalData.toFixed(2))
: null : null,
item.unit
] ]
}) })
@@ -287,7 +303,8 @@ const setEchart = () => {
item.time, item.time,
item.statisticalData !== null && item.statisticalData !== undefined item.statisticalData !== null && item.statisticalData !== undefined
? parseFloat(item.statisticalData.toFixed(2)) ? parseFloat(item.statisticalData.toFixed(2))
: null : null,
item.unit
] ]
}) })
@@ -432,10 +449,8 @@ watch(
} }
) )
onMounted(() => { onMounted(async () => {
initLineList().then(() => { await initLineList()
initCode()
})
}) })
watch( watch(

View File

@@ -14,7 +14,7 @@
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.lineId" :key="item.lineId"
:label="item.name" :label="item.lineName"
:value="item.lineId" :value="item.lineId"
/> />
</el-select> </el-select>
@@ -34,7 +34,7 @@ import TableHeader from '@/components/table/header/index.vue'
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import { mainHeight } from '@/utils/layout' import { mainHeight } from '@/utils/layout'
import HarmonicRatio from '@/components/cockpit/gridSideStatistics/components/harmonicRatio.vue' import HarmonicRatio from '@/components/cockpit/gridSideStatistics/components/harmonicRatio.vue'
import { cslineList } from '@/api/harmonic-boot/cockpit/cockpit' import { cslineList ,governLineList} from '@/api/harmonic-boot/cockpit/cockpit'
const dialogVisible: any = ref(false) const dialogVisible: any = ref(false)
const harmonicRatioRef: any = ref(null) const harmonicRatioRef: any = ref(null)
@@ -85,7 +85,7 @@ const tableStore: any = new TableStore({
width: '150' width: '150'
}, },
{ {
title: '闪变越限(%)', title: '长时闪变越限(%)',
field: 'flickerOvertime', field: 'flickerOvertime',
width: '90', width: '90',
render: 'customTemplate', render: 'customTemplate',
@@ -101,16 +101,7 @@ const tableStore: any = new TableStore({
title: '谐波电流越限(%)', title: '谐波电流越限(%)',
children: loop50('iharm') children: loop50('iharm')
}, },
{ {
title: '三相不平衡度越限(%)',
field: 'ubalanceOvertime',
width: '100',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.ubalanceOvertime}</span>`
}
},
{
title: '电压偏差越限(%)', title: '电压偏差越限(%)',
field: 'voltageDevOvertime', field: 'voltageDevOvertime',
width: '100', width: '100',
@@ -120,14 +111,24 @@ const tableStore: any = new TableStore({
} }
}, },
{ {
title: '频率偏差越限(%)', title: '三相不平衡度越限(%)',
field: 'freqDevOvertime', field: 'ubalanceOvertime',
width: '100', width: '100',
render: 'customTemplate', render: 'customTemplate',
customTemplate: (row: any) => { customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.freqDevOvertime}</span>` return `<span style='cursor: pointer;text-decoration: underline;'>${row.ubalanceOvertime}</span>`
} }
} },
// {
// title: '频率偏差越限(%)',
// field: 'freqDevOvertime',
// width: '100',
// render: 'customTemplate',
// customTemplate: (row: any) => {
// return `<span style='cursor: pointer;text-decoration: underline;'>${row.freqDevOvertime}</span>`
// }
// }
], ],
beforeSearchFun: () => { beforeSearchFun: () => {
}, },
@@ -139,8 +140,10 @@ const tableStore: any = new TableStore({
provide('tableStore', tableStore) provide('tableStore', tableStore)
tableStore.table.params.sortBy = '' tableStore.table.params.sortBy = ''
tableStore.table.params.orderBy = '' tableStore.table.params.orderBy = ''
const time:any=ref([])
const open = async (row: any,searchBeginTime:any,searchEndTime:any) => { const open = async (row: any,searchBeginTime:any,searchEndTime:any) => {
dialogVisible.value = true dialogVisible.value = true
time.value=[searchBeginTime,searchEndTime]
initCSlineList() initCSlineList()
tableStore.table.params.lineId = row.lineId tableStore.table.params.lineId = row.lineId
@@ -175,8 +178,19 @@ const onHarmonicRatioClose = () => {
} }
const initCSlineList = async () => { const initCSlineList = async () => {
const res = await cslineList({}) // const res = await cslineList({})
options.value = res.data const res = await governLineList({
endTime:time.value[1],
keywords:"",
pageNum:1,
pageSize:10000,
searchBeginTime:time.value[0],
searchEndTime:time.value[1],
startTime:time.value[0],
timeFlag:1
})
options.value = res.data.records
} }

View File

@@ -5,8 +5,9 @@
ref="TableHeaderRef" ref="TableHeaderRef"
:showReset="false" :showReset="false"
@selectChange="selectChange" @selectChange="selectChange"
datePicker
v-if="fullscreen" :timeKeyList="prop.timeKey" v-if="fullscreen"
:timeKeyList="prop.timeKey"
></TableHeader> ></TableHeader>
<Table <Table
ref="tableRef" ref="tableRef"
@@ -17,27 +18,35 @@
<OverLimitDetails ref="OverLimitDetailsRef" /> <OverLimitDetails ref="OverLimitDetailsRef" />
<!-- 上传对话框 --> <!-- 上传对话框 -->
<el-dialog v-model="uploadDialogVisible" title="上传报告" width="500px" @closed="handleDialogClosed"> <el-dialog
v-model="uploadDialogVisible"
title="上传报告"
append-to-body
width="500px"
@closed="handleDialogClosed"
>
<el-upload <el-upload
ref="uploadRef" ref="uploadRef"
class="upload-demo" class="upload-demo"
:auto-upload="true" action=""
accept=".doc,.docx,.PDF"
:on-change="handleChange" :on-change="handleChange"
:before-upload="beforeUpload" :before-upload="beforeUpload"
:http-request="handleUpload"
:limit="1" :limit="1"
:auto-upload="false"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:on-remove="handleRemove"
:file-list="fileList" :file-list="fileList"
> >
<el-button type="primary">点击上传</el-button> <el-button type="primary">点击上传</el-button>
<template #tip> <template #tip>
<div class="el-upload__tip">只能上传Word或PDF文件且不超过10MB</div> <div class="el-upload__tip">上传Word或PDF文件</div>
</template> </template>
</el-upload> </el-upload>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button @click="uploadDialogVisible = false">取消</el-button> <el-button @click="uploadDialogVisible = false">取消</el-button>
<el-button type="primary" @click="uploadDialogVisible = false">确定</el-button> <el-button type="primary" @click="handleUpload">确定</el-button>
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
@@ -59,7 +68,7 @@ const prop = defineProps({
h: { type: [String, Number] }, h: { type: [String, Number] },
width: { type: [String, Number] }, width: { type: [String, Number] },
height: { type: [String, Number] }, height: { type: [String, Number] },
timeKey: { type: Array as () => string[] }, timeKey: { type: Array as () => string[] },
timeValue: { type: Object }, timeValue: { type: Object },
interval: { type: Number } interval: { type: Number }
}) })
@@ -77,11 +86,11 @@ const fileList = ref([])
const selectChange = (showSelect: any, height: any, datePickerValue?: any) => { const selectChange = (showSelect: any, height: any, datePickerValue?: any) => {
headerHeight.value = height headerHeight.value = height
if (datePickerValue && datePickerValue.timeValue) { // if (datePickerValue && datePickerValue.timeValue) {
// 更新时间参数 // // 更新时间参数
tableStore.table.params.searchBeginTime = datePickerValue.timeValue[0] // tableStore.table.params.searchBeginTime = datePickerValue.timeValue[0]
tableStore.table.params.searchEndTime = datePickerValue.timeValue[1] // tableStore.table.params.searchEndTime = datePickerValue.timeValue[1]
} // }
} }
// 计算是否全屏展示 // 计算是否全屏展示
@@ -120,31 +129,76 @@ const tableStore: any = new TableStore({
return `<span style='cursor: pointer;text-decoration: underline;'>${row.lineName}</span>` return `<span style='cursor: pointer;text-decoration: underline;'>${row.lineName}</span>`
} }
}, },
{ title: '监测类型', field: 'position', minWidth: '80' }, {
title: '监测类型',
field: 'position',
minWidth: '80',
formatter: (row: any) => {
return row.cellValue || '/'
}
},
// {
// title: '监测点状态',
// field: 'runStatus',
// minWidth: '90',
// render: 'customTemplate',
// customTemplate: (row: any) => {
// return `<span style='color: ${row.runStatus === '中断' ? '#FF0000' : ''}'>${row.runStatus==null?'/':row.runStatus}</span>`
// }
// },
{ {
title: '监测点状态', title: '监测点状态',
field: 'runStatus', field: 'runStatus',
minWidth: '90', render: 'tag',
render: 'customTemplate',
customTemplate: (row: any) => { width: 100,
return `<span style='color: ${row.runStatus === '中断' ? '#FF0000' : ''}'>${row.runStatus}</span>` custom: {
停运: 'danger',
退运: 'danger',
运行: 'success',
在线: 'success',
中断: 'warning',
离线: 'danger',
检修: 'warning',
调试: 'warning',
null: 'info'
},
replaceValue: {
运行: '运行',
在线: '在线',
退运: '退运',
停运: '停运',
中断: '中断',
检修: '检修',
离线: '离线',
调试: '调试',
null: '/'
} }
}, },
{ {
title: '治理对象', title: '治理对象',
field: 'sensitiveUser', field: 'sensitiveUser',
minWidth: '90' minWidth: '90',
formatter: (row: any) => {
return row.cellValue || '/'
}
}, },
{ {
title: '电压等级', title: '电压等级',
field: 'volGrade', field: 'volGrade',
minWidth: '80' minWidth: '80',
formatter: (row: any) => {
return row.cellValue==0?'/': row.cellValue+'kV' || '/'
}
}, },
{ {
title: '是否治理', title: '是否治理',
field: 'govern', field: 'govern',
minWidth: '80' minWidth: '80',
formatter: (row: any) => {
return row.cellValue || '/'
}
}, },
{ {
@@ -160,10 +214,30 @@ const tableStore: any = new TableStore({
} }
} }
}, },
// {
// title: '报告',
// field: 'reportFilePath',
// minWidth: '120',
// render: 'customTemplate',
// customTemplate: (row: any) => {
// return row.reportFilePath == null
// ? '/'
// : `<span style='cursor: pointer;text-decoration: underline;'>${row.reportFilePath
// .split('/')
// .pop()}</span>`
// }
// },
{ {
title: '操作', title: '报告',
minWidth: 80, field: 'reportFilePath',
// fixed: 'right', minWidth: '120',
formatter: (row: any) => {
return row.cellValue == null ? '/' : row.cellValue.split('/').pop()
}
},
{
title: '操作', fixed: 'right',
width: 150,
render: 'buttons', render: 'buttons',
buttons: [ buttons: [
{ {
@@ -187,7 +261,7 @@ const tableStore: any = new TableStore({
icon: 'el-icon-EditPen', icon: 'el-icon-EditPen',
render: 'basicButton', render: 'basicButton',
click: row => { click: row => {
downloadTheReport(row.lineId) downloadTheReport(row.lineId, row.reportFilePath)
}, },
disabled: row => { disabled: row => {
return row.reportFilePath == null || row.reportFilePath.length == 0 return row.reportFilePath == null || row.reportFilePath.length == 0
@@ -223,22 +297,22 @@ tableStore.table.params.keywords = ''
provide('tableStore', tableStore) provide('tableStore', tableStore)
const setTime = () => { const setTime = () => {
const time = getTime( // const time = getTime(
(TableHeaderRef.value?.datePickerRef.interval || prop.interval) ?? 0, // (TableHeaderRef.value?.datePickerRef.interval || prop.interval) ?? 0,
prop.timeKey, // prop.timeKey,
fullscreen.value // fullscreen.value
? [tableStore.table.params.searchBeginTime, tableStore.table.params.searchEndTime] // ? [tableStore.table.params.searchBeginTime, tableStore.table.params.searchEndTime]
: prop.timeValue // : prop.timeValue
) // )
if (Array.isArray(time)) { // if (Array.isArray(time)) {
tableStore.table.params.searchBeginTime = time[0] // tableStore.table.params.searchBeginTime = time[0]
tableStore.table.params.searchEndTime = time[1] // tableStore.table.params.searchEndTime = time[1]
TableHeaderRef.value?.setInterval(time[2] - 0) // TableHeaderRef.value?.setInterval(time[2] - 0)
TableHeaderRef.value?.setTimeInterval([time[0], time[1]]) // TableHeaderRef.value?.setTimeInterval([time[0], time[1]])
} else { // } else {
console.warn('获取时间失败time 不是一个有效数组') // console.warn('获取时间失败time 不是一个有效数组')
} // }
} }
// 点击行 // 点击行
@@ -253,16 +327,43 @@ const cellClickEvent = ({ row, column }: any) => {
} }
// 下载报告 // 下载报告
const downloadTheReport = (lineId: string) => { const downloadTheReport = (lineId: string, name: string) => {
getReportUrl({ lineId: lineId }).then((res: any) => { getReportUrl({ lineId: lineId }).then((res: any) => {
const link = document.createElement('a') forceDownloadPdf(res.data, name.split('/').pop() || '')
link.href = res.data
link.download = '治理报告'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}) })
} }
const forceDownloadPdf = async (pdfUrl, fileName = '文件.pdf') => {
try {
// 1. 请求 PDF 并转为 Blob关键绕开浏览器直接解析
const response = await fetch(pdfUrl, {
method: 'GET'
// 若需要鉴权,添加请求头(如 token
})
// 校验响应是否成功
if (!response.ok) throw new Error(`请求失败:${response.status}`)
// 2. 将响应转为 Blob指定类型为 PDF确保兼容性
const blob = await response.blob()
const pdfBlob = new Blob([blob], { type: 'application/pdf' })
// 3. 创建临时 URL 并触发下载
const blobUrl = URL.createObjectURL(pdfBlob)
const a = document.createElement('a')
a.href = blobUrl
a.download = fileName // 此时 Blob URL 是同源的download 必生效
a.style.display = 'none'
document.body.appendChild(a)
a.click() // 触发下载
// 4. 清理资源(避免内存泄漏)
document.body.removeChild(a)
URL.revokeObjectURL(blobUrl)
} catch (error) {
console.error('PDF 下载失败:', error)
// ElMessage.error('文件下载失败,请检查网络或文件地址') // 适配 Element Plus
}
}
// 上传报告 // 上传报告
const uploadReportRow = (row: any) => { const uploadReportRow = (row: any) => {
@@ -279,14 +380,18 @@ const handleDialogClosed = () => {
} }
// 处理文件超出限制 // 处理文件超出限制
const handleExceed = (files: any, fileList: any) => { const handleExceed = (files: any) => {
ElMessage.warning('只能上传一个文件,请先删除已选择的文件') ElMessage.warning('只能上传一个文件,请先删除已选择的文件')
} }
const handleRemove = (files: any) => {
fileList.value = []
}
// 文件变更处理函数 // 文件变更处理函数
const handleChange = (file: any, fileList: any) => { const handleChange = (file: any) => {
// 在这里直接处理文件上传逻辑 // 在这里直接处理文件上传逻辑
beforeUpload(file.raw) // 注意使用 file.raw 获取原始文件对象 // beforeUpload(file.raw) // 注意使用 file.raw 获取原始文件对象
fileList.value = [file] // 只保留最新选择的文件
} }
// 处理上传前检查 // 处理上传前检查
@@ -303,11 +408,7 @@ const beforeUpload = (file: any) => {
const isLt10M = file.size / 1024 / 1024 < 10 const isLt10M = file.size / 1024 / 1024 < 10
if (!isValidType) { if (!isValidType) {
ElMessage.error('上传文件只能是 Word 文档(.doc/.docx) 或 PDF 文件(.pdf)!') ElMessage.error('上传(.doc/.docx/.pdf)格式文件!')
return false
}
if (!isLt10M) {
ElMessage.error('上传文件大小不能超过 10MB!')
return false return false
} }
@@ -315,10 +416,11 @@ const beforeUpload = (file: any) => {
return true return true
} }
const handleUpload = async (options: any) => { const handleUpload = async () => {
const { file } = options // return
const formData = new FormData() const formData = new FormData()
formData.append('file', file) formData.append('file', fileList.value[0]?.raw)
formData.append('lineId', currentUploadRow.value?.lineId || currentUploadRow.value?.id || '') formData.append('lineId', currentUploadRow.value?.lineId || currentUploadRow.value?.id || '')
try { try {

View File

@@ -66,7 +66,7 @@
<el-option <el-option
v-for="vv in item.countOptions" v-for="vv in item.countOptions"
:key="vv" :key="vv"
:label="vv" :label="item.name.includes('间谐波') ? vv - 0.5 : vv"
:value="vv" :value="vv"
></el-option> ></el-option>
</el-select> </el-select>
@@ -82,11 +82,7 @@
</TableHeader> </TableHeader>
</div> </div>
<div class="history_chart" :style="pageHeight" v-loading="loading"> <div class="history_chart" :style="pageHeight" v-loading="loading">
<MyEchart <MyEchart ref="historyChart" :options="echartsData" v-if="showEchart" />
ref="historyChart"
:options="echartsData"
v-if="showEchart"
/>
<el-empty :style="pageHeight" v-else description="暂无数据" /> <el-empty :style="pageHeight" v-else description="暂无数据" />
</div> </div>
</el-dialog> </el-dialog>
@@ -160,28 +156,40 @@ const countOptions: any = ref([])
const legendDictList: any = ref([]) const legendDictList: any = ref([])
const initCode = (field: string, title: string) => { const initCode = (field: string, title: string) => {
queryByCode('steady_state_limit_trend').then(res => { queryByCode('gridSide_exceedTheLimit').then(res => {
queryCsDictTree(res.data.id).then(item => { queryCsDictTree(res.data.id).then(item => {
//排序 //排序
indexOptions.value = item.data.sort((a: any, b: any) => { indexOptions.value = item.data.sort((a: any, b: any) => {
return a.sort - b.sort return a.sort - b.sort
}) })
const titleMap: Record<string, number> = { // const titleMap: Record<string, number> = {
flickerOvertime: 0, // flickerOvertime: 0,
uaberranceOvertime: 3, // uaberranceOvertime: 3,
ubalanceOvertime: 4, // ubalanceOvertime: 4,
freqDevOvertime: 5 // freqDevOvertime: 5
} // }
let defaultIndex = 0 // 默认值 // let defaultIndex = 0 // 默认值
if (field in titleMap) { // if (field in titleMap) {
defaultIndex = titleMap[field] // defaultIndex = titleMap[field]
} else if (field.includes('uharm')) { // } else if (field.includes('uharm')) {
defaultIndex = 1 // defaultIndex = 1
} else if (field.includes('iharm')) { // } else if (field.includes('iharm')) {
defaultIndex = 2 // defaultIndex = 2
} // }
let codeKey = field.includes('flickerOvertime')
? '闪变'
: field.includes('uharm')
? '谐波电压'
: field.includes('iharm')
? '谐波电流'
: field.includes('voltageDevOvertime')
? '电压偏差'
: field.includes('ubalanceOvertime')
? '不平衡'
: ''
let defaultIndex = indexOptions.value.findIndex((item: any) => item.name.includes(codeKey)) || 0
searchForm.value.index[0] = indexOptions.value[defaultIndex].id searchForm.value.index[0] = indexOptions.value[defaultIndex].id
}) })
@@ -205,7 +213,7 @@ const initCode = (field: string, title: string) => {
if (kk.harmStart && kk.harmEnd) { if (kk.harmStart && kk.harmEnd) {
range(0, 0, 0) range(0, 0, 0)
if (kk.showName == '间谐波电压含有率') { if (kk.showName.includes('间谐波电压')) {
countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1).map( countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1).map(
(item: any) => { (item: any) => {
return item - 0.5 return item - 0.5
@@ -294,7 +302,7 @@ const init = async () => {
} }
lists[index] = { lists[index] = {
statisticalId: item.index, statisticalId: item.index,
frequency: frequencys !== null && frequencys !== undefined ? String(frequencys) : '' frequency: frequencys !== null && frequencys !== undefined ? String(frequencys) : ''
} }
}) })
let obj = { let obj = {
@@ -600,12 +608,12 @@ const formatCountOptions = () => {
}) })
countData.value.map((item: any, key: any) => { countData.value.map((item: any, key: any) => {
if (item.name == '谐波电流有效值') { if (item.name.includes('谐波电压')) {
item.name = '谐波电流次数'
} else if (item.name == '谐波电压含有率') {
item.name = '谐波电压次数'
} else if (item.name == '间谐波电压含有率') {
item.name = '间谐波电压次数' item.name = '间谐波电压次数'
} else if (item.name.includes('谐波电流')) {
item.name = '谐波电流次数'
} else if (item.name.includes('谐波电压')) {
item.name = '谐波电压次数'
} }
}) })
} }

View File

@@ -14,7 +14,7 @@
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.lineId" :key="item.lineId"
:label="item.name" :label="item.lineName"
:value="item.lineId" :value="item.lineId"
/> />
</el-select> </el-select>
@@ -85,7 +85,7 @@ const tableStore: any = new TableStore({
width: '150' width: '150'
}, },
{ {
title: '闪变越限(%)', title: '长时闪变越限(%)',
field: 'flickerOvertime', field: 'flickerOvertime',
width: '90', width: '90',
render: 'customTemplate', render: 'customTemplate',
@@ -101,16 +101,7 @@ const tableStore: any = new TableStore({
title: '谐波电流越限(%)', title: '谐波电流越限(%)',
children: loop50('iharm') children: loop50('iharm')
}, },
{ {
title: '三相不平衡度越限(%)',
field: 'ubalanceOvertime',
width: '100',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.ubalanceOvertime}</span>`
}
},
{
title: '电压偏差越限(%)', title: '电压偏差越限(%)',
field: 'voltageDevOvertime', field: 'voltageDevOvertime',
width: '100', width: '100',
@@ -120,14 +111,24 @@ const tableStore: any = new TableStore({
} }
}, },
{ {
title: '频率偏差越限(%)', title: '三相不平衡度越限(%)',
field: 'freqDevOvertime', field: 'ubalanceOvertime',
width: '100', width: '100',
render: 'customTemplate', render: 'customTemplate',
customTemplate: (row: any) => { customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.freqDevOvertime}</span>` return `<span style='cursor: pointer;text-decoration: underline;'>${row.ubalanceOvertime}</span>`
} }
} },
// {
// title: '频率偏差越限(%)',
// field: 'freqDevOvertime',
// width: '100',
// render: 'customTemplate',
// customTemplate: (row: any) => {
// return `<span style='cursor: pointer;text-decoration: underline;'>${row.freqDevOvertime}</span>`
// }
// }
], ],
beforeSearchFun: () => { beforeSearchFun: () => {
}, },
@@ -139,9 +140,10 @@ const tableStore: any = new TableStore({
provide('tableStore', tableStore) provide('tableStore', tableStore)
tableStore.table.params.sortBy = '' tableStore.table.params.sortBy = ''
tableStore.table.params.orderBy = '' tableStore.table.params.orderBy = ''
const open = async (row: any,searchBeginTime:any,searchEndTime:any) => { const open = async (row: any,searchBeginTime:any,searchEndTime:any,data: any) => {
dialogVisible.value = true dialogVisible.value = true
initCSlineList() // initCSlineList()
options.value = data
tableStore.table.params.lineId = row.lineId tableStore.table.params.lineId = row.lineId
nextTick(() => { nextTick(() => {

View File

@@ -89,7 +89,7 @@ const initEcharts = () => {
xAxis: { xAxis: {
// name: '(区域)', // name: '(区域)',
data: ['闪变', '谐波电压', '谐波电流', '电压偏差', '三相不平衡'] data: ['长时闪变', '谐波电压', '谐波电流', '电压偏差', '三相不平衡']
}, },
yAxis: { yAxis: {
@@ -150,7 +150,7 @@ const tableStore: any = new TableStore({
title: '越限占比(%)', title: '越限占比(%)',
children: [ children: [
{ {
title: '闪变', title: '长时闪变',
field: 'flicker', field: 'flicker',
minWidth: '70', minWidth: '70',
render: 'customTemplate', render: 'customTemplate',
@@ -217,7 +217,8 @@ const cellClickEvent = ({ row, column }: any) => {
OverLimitDetailsRef.value.open( OverLimitDetailsRef.value.open(
row, row,
tableStore.table.params.searchBeginTime || prop.timeValue?.[0], tableStore.table.params.searchBeginTime || prop.timeValue?.[0],
tableStore.table.params.searchEndTime || prop.timeValue?.[1] tableStore.table.params.searchEndTime || prop.timeValue?.[1],
tableStore.table.data
) )
} }
} }

View File

@@ -5,8 +5,9 @@
ref="TableHeaderRef" ref="TableHeaderRef"
:showReset="false" :showReset="false"
@selectChange="selectChange" @selectChange="selectChange"
datePicker
v-if="fullscreen" :timeKeyList="prop.timeKey" v-if="fullscreen"
:timeKeyList="prop.timeKey"
></TableHeader> ></TableHeader>
<Table <Table
ref="tableRef" ref="tableRef"
@@ -29,7 +30,7 @@ const prop = defineProps({
h: { type: [String, Number] }, h: { type: [String, Number] },
width: { type: [String, Number] }, width: { type: [String, Number] },
height: { type: [String, Number] }, height: { type: [String, Number] },
timeKey: { type: Array as () => string[] }, timeKey: { type: Array as () => string[] },
timeValue: { type: Object }, timeValue: { type: Object },
interval: { type: Number } interval: { type: Number }
}) })
@@ -44,11 +45,11 @@ const sensitiveUserType = dictData.getBasicData('Interference_Source')
const selectChange = (showSelect: any, height: any, datePickerValue?: any) => { const selectChange = (showSelect: any, height: any, datePickerValue?: any) => {
headerHeight.value = height headerHeight.value = height
if (datePickerValue && datePickerValue.timeValue) { // if (datePickerValue && datePickerValue.timeValue) {
// 更新时间参数 // // 更新时间参数
tableStore.table.params.searchBeginTime = datePickerValue.timeValue[0] // tableStore.table.params.searchBeginTime = datePickerValue.timeValue[0]
tableStore.table.params.searchEndTime = datePickerValue.timeValue[1] // tableStore.table.params.searchEndTime = datePickerValue.timeValue[1]
} // }
} }
// 计算是否全屏展示 // 计算是否全屏展示
@@ -94,12 +95,18 @@ const tableStore: any = new TableStore({
{ {
title: '是否监测', title: '是否监测',
field: 'isMonitor', field: 'isMonitor',
minWidth: '80' minWidth: '80',
formatter: (row: any) => {
return row.cellValue || '/'
}
}, },
{ {
title: '是否治理', title: '是否治理',
field: 'isGovern', field: 'isGovern',
minWidth: '80' minWidth: '80',
formatter: (row: any) => {
return row.cellValue || '/'
}
} }
], ],
beforeSearchFun: () => { beforeSearchFun: () => {
@@ -123,22 +130,22 @@ const cellClickEvent = ({ row, column }: any) => {
} }
const setTime = () => { const setTime = () => {
const time = getTime( // const time = getTime(
(TableHeaderRef.value?.datePickerRef.interval || prop.interval) ?? 0, // (TableHeaderRef.value?.datePickerRef.interval || prop.interval) ?? 0,
prop.timeKey, // prop.timeKey,
fullscreen.value // fullscreen.value
? [tableStore.table.params.searchBeginTime, tableStore.table.params.searchEndTime] // ? [tableStore.table.params.searchBeginTime, tableStore.table.params.searchEndTime]
: prop.timeValue // : prop.timeValue
) // )
if (Array.isArray(time)) { // if (Array.isArray(time)) {
tableStore.table.params.searchBeginTime = time[0] // tableStore.table.params.searchBeginTime = time[0]
tableStore.table.params.searchEndTime = time[1] // tableStore.table.params.searchEndTime = time[1]
TableHeaderRef.value?.setInterval(time[2] - 0) // TableHeaderRef.value?.setInterval(time[2] - 0)
TableHeaderRef.value?.setTimeInterval([time[0], time[1]]) // TableHeaderRef.value?.setTimeInterval([time[0], time[1]])
} else { // } else {
console.warn('获取时间失败time 不是一个有效数组') // console.warn('获取时间失败time 不是一个有效数组')
} // }
} }
onMounted(() => { onMounted(() => {

View File

@@ -166,8 +166,8 @@ const tableStore: any = new TableStore({
// ...row, // ...row,
// duration: row.persistTime // 将 persistTime 值赋给 duration // duration: row.persistTime // 将 persistTime 值赋给 duration
// } // }
boxoList.value.featureAmplitude = boxoList.value.featureAmplitude = (row.amplitude - 0) / 100
row.evtParamVVaDepth != '-' ? row.evtParamVVaDepth - 0 : null // row.evtParamVVaDepth != '-' ? row.evtParamVVaDepth - 0 : null
boxoList.value.systemType = 'YPT' boxoList.value.systemType = 'YPT'
wp.value = res.data wp.value = res.data
} }

View File

@@ -166,8 +166,9 @@ const tableStore: any = new TableStore({
// ...row, // ...row,
// duration: row.persistTime // 将 persistTime 值赋给 duration // duration: row.persistTime // 将 persistTime 值赋给 duration
// } // }
boxoList.value.featureAmplitude = // boxoList.value.featureAmplitude =
row.evtParamVVaDepth != '-' ? row.evtParamVVaDepth - 0 : null // row.evtParamVVaDepth != '-' ? row.evtParamVVaDepth - 0 : null
boxoList.value.featureAmplitude = (row.amplitude - 0) / 100
boxoList.value.systemType = 'YPT' boxoList.value.systemType = 'YPT'
wp.value = res.data wp.value = res.data
} }

View File

@@ -81,6 +81,7 @@
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px)` height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px)`
}" }"
/> />
<!-- <el-empty description="暂无数据" /> -->
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -92,7 +93,8 @@ import { useConfig } from '@/stores/config'
import { queryByCode, queryCsDictTree } from '@/api/system-boot/dictTree' import { queryByCode, queryCsDictTree } from '@/api/system-boot/dictTree'
import { getListByIds } from '@/api/harmonic-boot/cockpit/cockpit' import { getListByIds } from '@/api/harmonic-boot/cockpit/cockpit'
import { getTime } from '@/utils/formatTime' import { getTime } from '@/utils/formatTime'
import { yMethod, exportCSV } from '@/utils/echartMethod'
import { max } from 'lodash'
const prop = defineProps({ const prop = defineProps({
w: { type: [String, Number] }, w: { type: [String, Number] },
h: { type: [String, Number] }, h: { type: [String, Number] },
@@ -127,14 +129,16 @@ const echartList = ref()
const headerHeight = ref(57) const headerHeight = ref(57)
// 监测对象 // 监测对象
const idList = ref() const idList = ref([])
// 监测对象 // 监测对象
const initListByIds = () => { const initListByIds = () => {
getListByIds({}).then((res: any) => { getListByIds({}).then((res: any) => {
if (res.data.length > 0) { if (res.data?.length > 0) {
idList.value = res.data idList.value = res.data
initCode() initCode()
} else {
tableStore.index()
} }
}) })
} }
@@ -179,7 +183,7 @@ const setEchart = () => {
if (!beforeGroupedByPhase[phase]) { if (!beforeGroupedByPhase[phase]) {
beforeGroupedByPhase[phase] = [] beforeGroupedByPhase[phase] = []
} }
beforeGroupedByPhase[phase].push([item.time, item.statisticalData]) beforeGroupedByPhase[phase].push([item.time, item.statisticalData, item.unit, 'solid'])
}) })
// 处理治理后数据 // 处理治理后数据
@@ -188,7 +192,7 @@ const setEchart = () => {
if (!afterGroupedByPhase[phase]) { if (!afterGroupedByPhase[phase]) {
afterGroupedByPhase[phase] = [] afterGroupedByPhase[phase] = []
} }
afterGroupedByPhase[phase].push([item.time, item.statisticalData]) afterGroupedByPhase[phase].push([item.time, item.statisticalData, item.unit, 'dotted'])
}) })
// 构建系列数据 // 构建系列数据
@@ -259,6 +263,11 @@ const setEchart = () => {
titleText = afterData[0].anotherName titleText = afterData[0].anotherName
} }
// statisticalData
// chartsListBefore.value.map((item: any) => item.statisticalData)
// chartsListAfter.value = tableStore.table.data.after
// 构建图例数据 // 构建图例数据
const legendData = series.map((item: any, index: number) => { const legendData = series.map((item: any, index: number) => {
let color = config.layout.elementUiPrimary[0] let color = config.layout.elementUiPrimary[0]
@@ -288,11 +297,45 @@ const setEchart = () => {
} }
} }
}) })
let [min, max] = yMethod(
[...chartsListBefore.value.map((item: any) => item.statisticalData),
...chartsListAfter.value.map((item: any) => item.statisticalData)]
)
echartList.value = { echartList.value = {
title: { title: {
text: titleText text: titleText
}, },
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,
formatter(params: any) {
const xname = params[0].value[0]
let str = `${xname}<br>`
params.forEach((el: any, index: any) => {
let marker = ''
marker = `<span style="display:inline-block;border: 2px ${el.color} ${el.value[3]};margin-right:5px;width:40px;height:0px;background-color:#ffffff00;"></span>`
str += `${marker}${el.seriesName.split('(')[0]}${
el.value[1] != null ? el.value[1] + ' ' + (el.value[2] == null ? '' : el.value[2]) : '-'
}<br>`
})
return str
}
},
legend: { legend: {
data: legendData, data: legendData,
icon: 'rect', icon: 'rect',
@@ -316,7 +359,9 @@ const setEchart = () => {
} }
}, },
yAxis: { yAxis: {
name: beforeData.length > 0 ? beforeData[0].unit : afterData.length > 0 ? afterData[0].unit : '' name: beforeData.length > 0 ? beforeData[0].unit : afterData.length > 0 ? afterData[0].unit : '',
max: max,
min: min,
}, },
grid: { grid: {
left: '10px', left: '10px',
@@ -368,8 +413,8 @@ const tableStore: any = new TableStore({
} }
}) })
tableStore.table.params.indicator = '1' tableStore.table.params.indicator = ''
tableStore.table.params.exceedingTheLimit = '1' tableStore.table.params.exceedingTheLimit = ''
tableStore.table.params.dataLevel = 'Primary' tableStore.table.params.dataLevel = 'Primary'
tableStore.table.params.valueType = 'avg' tableStore.table.params.valueType = 'avg'
provide('tableStore', tableStore) provide('tableStore', tableStore)
@@ -405,7 +450,7 @@ const shouldShowHarmonicCount = () => {
return ( return (
currentIndicator && currentIndicator &&
(currentIndicator.name.includes('电压谐波含有率') || currentIndicator.name.includes('电流谐波含有率')) (currentIndicator.name.includes('幅值') || currentIndicator.name.includes('含有率'))
) )
} }
@@ -414,9 +459,9 @@ const getHarmonicTypeName = () => {
const currentIndicator = indicatorList.value.find((item: any) => item.id === tableStore.table.params.indicator) const currentIndicator = indicatorList.value.find((item: any) => item.id === tableStore.table.params.indicator)
if (currentIndicator) { if (currentIndicator) {
if (currentIndicator.name.includes('电压谐波含有率')) { if (currentIndicator.name.includes('电压')) {
return '电压' return '电压'
} else if (currentIndicator.name.includes('电流谐波含有率')) { } else if (currentIndicator.name.includes('电流')) {
return '电流' return '电流'
} }
} }

View File

@@ -266,8 +266,6 @@ self.onmessage = function (e) {
} else if (boxoList.systemType == 'ZL') { } else if (boxoList.systemType == 'ZL') {
titles = titles =
(boxoList.engineeringName == undefined ? '' : ' 项目名称:' + boxoList.engineeringName) + (boxoList.engineeringName == undefined ? '' : ' 项目名称:' + boxoList.engineeringName) +
' 项目名称:' +
boxoList.engineeringName +
' 监测点名称:' + ' 监测点名称:' +
boxoList.equipmentName + boxoList.equipmentName +
' 发生时刻:' + ' 发生时刻:' +
@@ -280,8 +278,6 @@ self.onmessage = function (e) {
} else if (boxoList.systemType == 'YPT') { } else if (boxoList.systemType == 'YPT') {
titles = titles =
(boxoList.engineeringName == undefined ? '' : ' 项目名称:' + boxoList.engineeringName) + (boxoList.engineeringName == undefined ? '' : ' 项目名称:' + boxoList.engineeringName) +
' 项目名称:' +
boxoList.engineeringName +
' 监测点名称:' + ' 监测点名称:' +
boxoList.lineName + boxoList.lineName +
' 发生时刻:' + ' 发生时刻:' +
@@ -293,15 +289,15 @@ self.onmessage = function (e) {
's' 's'
} else { } else {
titles = titles =
'变电站名称:' + ' 变电站名称:' +
boxoList.subName + boxoList.subName +
' 监测点名称:' + ' 监测点名称:' +
boxoList.lineName + boxoList.lineName +
' 发生时刻:' + ' 发生时刻:' +
boxoList.startTime + boxoList.startTime +
' 暂降(骤升)幅值:' + ' 暂降(骤升)幅值:' +
(boxoList.featureAmplitude * 100).toFixed(2) + (boxoList.featureAmplitude * 100).toFixed(2) +
'% 持续时间:' + '% 持续时间:' +
boxoList.duration + boxoList.duration +
's' 's'
} }

View File

@@ -1,8 +1,8 @@
<template> <template>
<div v-loading="loading" style="position: relative; height: 100%"> <div v-loading="loading" style="position: relative; height: 100%">
<div id="boxr"> <div id="boxr">
<div id="rmsp" :style="`height:${vh};overflow: hidden;`"> <div id="rmsp" :style="`height:${vh};overflow: hidden;min-height: 200px;`">
<div class="bx" id="rms"></div> <div class="bx" id="rms" style="min-height: 200px"></div>
</div> </div>
</div> </div>
</div> </div>
@@ -594,10 +594,10 @@ const initWave = (
for (let step = waveDatas.length - 1; step > 0 && step < waveDatas.length; step--) { for (let step = waveDatas.length - 1; step > 0 && step < waveDatas.length; step--) {
const rmsId = 'rms' + step const rmsId = 'rms' + step
const newDivRms = $( const newDivRms = $(
`<div style="height:${vh.value};overflow: hidden;"><div class='bx' id='${rmsId}'></div></div>` `<div style="height:${vh.value};overflow: hidden;min-height: 200px;"><div class='bx' id='${rmsId}'></div></div>`
) )
newDivRms.insertAfter($('#rmsp')) newDivRms.insertAfter($('#rmsp'))
$(`#${rmsId}`).css('height', picHeight).css('width', vw.value) $(`#${rmsId}`).css('height', picHeight).css('width', vw.value).css('min-height', '200px')
} }
} else { } else {
titleText = `变电站名称:${subName.value} 监测点名称:${lineName.value} 发生时刻:${time} 暂降(骤升)幅值:${( titleText = `变电站名称:${subName.value} 监测点名称:${lineName.value} 发生时刻:${time} 暂降(骤升)幅值:${(
@@ -749,7 +749,7 @@ const initWave = (
y: -10 y: -10
}, },
max: rmscm[0]?.[1] * 1.06 || 0, max: rmscm[0]?.[1] * 1.06 || 0,
min: rmscu[0]?.[1] - rmscu[0]?.[1] * 0.04 || 0, min: rmscu[0]?.[1] - rmscu[0]?.[1] * 0.2 || 0,
boundaryGap: [0, '100%'], boundaryGap: [0, '100%'],
showLastLabel: true, showLastLabel: true,
opposite: false, opposite: false,
@@ -768,7 +768,7 @@ const initWave = (
fontSize: '12px', fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor, color: props.DColor ? '#000' : echartsColor.WordColor,
formatter: function (value: number) { formatter: function (value: number) {
return (value - 0).toFixed(2) return Math.floor(value * 1000) / 1000
} }
}, },
splitLine: { splitLine: {
@@ -1092,7 +1092,8 @@ const drawPics = (
fontSize: '12px', fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor, color: props.DColor ? '#000' : echartsColor.WordColor,
formatter: function (value: number) { formatter: function (value: number) {
return (value - 0).toFixed(2) // return (value - 0).toFixed(2)
return Math.floor(value * 1000) / 1000
} }
}, },
splitLine: { splitLine: {

View File

@@ -127,13 +127,13 @@ self.addEventListener('message', function (e) {
titles = titles =
'变电站名称:' + '变电站名称:' +
boxoList.powerStationName + boxoList.powerStationName +
' 监测点名称:' + ' 监测点名称:' +
boxoList.measurementPointName + boxoList.measurementPointName +
' 发生时刻:' + ' 发生时刻:' +
boxoList.startTime + boxoList.startTime +
' 暂降(骤升)幅值:' + ' 暂降(骤升)幅值:' +
(boxoList.featureAmplitude * 100).toFixed(2) + (boxoList.featureAmplitude * 100).toFixed(2) +
'% 持续时间:' + '% 持续时间:' +
boxoList.duration + boxoList.duration +
's' 's'
} else if (boxoList.systemType == 'ZL') { } else if (boxoList.systemType == 'ZL') {
@@ -141,11 +141,11 @@ self.addEventListener('message', function (e) {
(boxoList.engineeringName == undefined ? '' : ' 项目名称:' + boxoList.engineeringName) + (boxoList.engineeringName == undefined ? '' : ' 项目名称:' + boxoList.engineeringName) +
' 监测点名称:' + ' 监测点名称:' +
boxoList.equipmentName + boxoList.equipmentName +
' 发生时刻:' + ' 发生时刻:' +
boxoList.startTime + boxoList.startTime +
' 暂降(骤升)幅值:' + ' 暂降(骤升)幅值:' +
boxoList.evtParamVVaDepth + boxoList.evtParamVVaDepth +
'% 持续时间:' + '% 持续时间:' +
boxoList.evtParamTm + boxoList.evtParamTm +
's' 's'
} else if (boxoList.systemType == 'YPT') { } else if (boxoList.systemType == 'YPT') {

View File

@@ -1,8 +1,8 @@
<template> <template>
<div v-loading="loading" class="boxbx" style="position: relative; height: 100%"> <div v-loading="loading" class="boxbx" style="position: relative; height: 100%">
<div id="boxsj"> <div id="boxsj">
<div id="shushi" :style="`height:${vh};overflow: hidden;`"> <div id="shushi" :style="`height:${vh};overflow: hidden;min-height: 200px;`">
<div class="bx" id="wave"></div> <div class="bx" id="wave" style="min-height: 200px"></div>
</div> </div>
</div> </div>
</div> </div>
@@ -327,11 +327,11 @@ const initWave = (
for (let step = waveDatas.length - 1; step > 0 && step < waveDatas.length; step--) { for (let step = waveDatas.length - 1; step > 0 && step < waveDatas.length; step--) {
const waveId = 'wave' + step const waveId = 'wave' + step
const newDivShunshi = $(`<div style="height:${vh.value};overflow: hidden;"> const newDivShunshi = $(`<div style="height:${vh.value};overflow: hidden;min-height: 200px;">
<div class='bx1' id='${waveId}'></div> <div class='bx1' id='${waveId}'></div>
</div>`) </div>`)
newDivShunshi.insertAfter($('#shushi')) newDivShunshi.insertAfter($('#shushi'))
$(`#${waveId}`).css('height', picHeight).css('width', vw.value) $(`#${waveId}`).css('height', picHeight).css('width', vw.value).css('min-height', '200px')
} }
} else { } else {
titleText = `变电站名称:${subName.value} 监测点名称:${lineName.value} 发生时刻:${time} 暂降(骤升)幅值:${( titleText = `变电站名称:${subName.value} 监测点名称:${lineName.value} 发生时刻:${time} 暂降(骤升)幅值:${(
@@ -499,7 +499,8 @@ const initWave = (
fontSize: '12px', fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor, color: props.DColor ? '#000' : echartsColor.WordColor,
formatter: function (value: number) { formatter: function (value: number) {
return (value - 0).toFixed(2) // return (value - 0).toFixed(2)
return Math.floor(value * 1000) / 1000
} }
}, },
splitLine: { splitLine: {
@@ -591,7 +592,7 @@ const initWave = (
const drawPics = ( const drawPics = (
waveDataTemp: WaveData, waveDataTemp: WaveData,
picHeight: string, picHeight: any,
step: number, step: number,
show: boolean, show: boolean,
myChartes1: echarts.ECharts, myChartes1: echarts.ECharts,
@@ -806,7 +807,8 @@ const drawPics = (
fontSize: '12px', fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor, color: props.DColor ? '#000' : echartsColor.WordColor,
formatter: function (value: number) { formatter: function (value: number) {
return (value - 0).toFixed(2) // return (value - 0).toFixed(2)
return Math.floor(value * 1000) / 1000
} }
}, },
splitLine: { splitLine: {

View File

@@ -21,8 +21,8 @@
<el-image <el-image
:hide-on-click-modal="true" :hide-on-click-modal="true"
:preview-teleported="true" :preview-teleported="true"
:preview-src-list="[fieldValue]" :preview-src-list="[imgList[fieldValue]]"
:src="fieldValue.length > 100 ? fieldValue : getUrl(fieldValue)" :src="fieldValue.length > 100 ? fieldValue : getUrl(fieldValue) ? imgList[fieldValue] : ''"
></el-image> ></el-image>
</div> </div>
@@ -226,10 +226,12 @@ const handlerCommand = (item: OptButton) => {
break break
} }
} }
const imgList: any = ref({})
const getUrl = (url: string) => { const getUrl = (url: string) => {
getFileUrl({ filePath: url }).then(res => { getFileUrl({ filePath: url }).then(res => {
return res.data imgList.value[url] = res.data
}) })
return true
} }
</script> </script>

View File

@@ -2,7 +2,7 @@
<div ref="tableHeader" class="cn-table-header"> <div ref="tableHeader" class="cn-table-header">
<div class="table-header ba-scroll-style" :key="num"> <div class="table-header ba-scroll-style" :key="num">
<el-form <el-form
style="flex: 1; height: 34px; margin-right: 20px; display: flex; flex-wrap: wrap" style="flex: 1; height: 34px; margin-right: 0px; display: flex; flex-wrap: wrap"
ref="headerForm" ref="headerForm"
@submit.prevent="" @submit.prevent=""
@keyup.enter="onComSearch" @keyup.enter="onComSearch"
@@ -29,12 +29,27 @@
<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 @click="onComSearch" v-if="showSearch" type="primary" :icon="Search">查询</el-button> <el-button
<el-button @click="onResetForm" v-if="showSearch && showReset" :icon="RefreshLeft">重置</el-button> @click="onComSearch"
v-if="showSearch"
:loading="tableStore.table.loading"
type="primary"
:icon="Search"
>
查询
</el-button>
<el-button
@click="onResetForm"
v-if="showSearch && showReset"
:loading="tableStore.table.loading"
:icon="RefreshLeft"
>
重置
</el-button>
<el-button <el-button
@click="onExport" @click="onExport"
v-if="showExport" v-if="showExport"
:loading="tableStore.table.loading" :loading="tableStore.table.exportLoading"
type="primary" type="primary"
icon="el-icon-Download" icon="el-icon-Download"
> >

View File

@@ -1,6 +1,6 @@
<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">
<div class="mt15 mr10" style="display: flex; justify-content: end"> <div class="mt10 mr10" style="display: flex; justify-content: end">
<el-button type="primary" icon="el-icon-Select" @click="save" :loading="loading">保存</el-button> <el-button type="primary" icon="el-icon-Select" @click="save" :loading="loading">保存</el-button>
</div> </div>
<Icon <Icon
@@ -39,7 +39,7 @@
</div> </div>
<el-tree <el-tree
:style="{ height: 'calc(100vh - 235px)' }" :style="{ height: 'calc(100vh - 267px)' }"
style="overflow: auto" style="overflow: auto"
ref="treeRef" ref="treeRef"
:props="defaultProps" :props="defaultProps"
@@ -183,5 +183,7 @@ defineExpose({ treeRef, loading })
.custom-tree-node { .custom-tree-node {
display: flex; display: flex;
align-items: center; align-items: center;
} }
</style> </style>

View File

@@ -110,7 +110,7 @@
</template> </template>
</el-tree> </el-tree>
</el-collapse-item> </el-collapse-item>
<el-collapse-item title="在线设备" name="2" v-if="frontDeviceData.length != 0"> <el-collapse-item title="监测设备" name="2" v-if="frontDeviceData.length != 0">
<el-tree <el-tree
:style="{ :style="{
height: height:
@@ -202,7 +202,7 @@ watch(
item.children.map((vv: any) => { item.children.map((vv: any) => {
bxsDeviceData.value.push(vv) bxsDeviceData.value.push(vv)
}) })
} else if (item.name == '在线设备') { } else if (item.name == '监测设备') {
frontDeviceData.value = [] frontDeviceData.value = []
item.children.map((vv: any) => { item.children.map((vv: any) => {
@@ -300,7 +300,6 @@ const chooseNode = (value: string, data: any, node: any) => {
} }
const changeDevice = (val: any) => { const changeDevice = (val: any) => {
console.log('changeDevice', val)
let arr1: any = [] let arr1: any = []
//zlDeviceData //zlDeviceData
@@ -331,22 +330,30 @@ const changeDevice = (val: any) => {
arr2.map((item: any) => { arr2.map((item: any) => {
item.checked = false item.checked = false
}) })
treeRef1.value && treeRef1.value.setCurrentKey(arr1[0]?.id)
emit('changeDeviceType', activeName.value, arr1[0]) emit('changeDeviceType', activeName.value, arr1[0])
setTimeout(() => {
treeRef1.value?.setCurrentKey(arr1[0]?.id)
}, 100)
} }
if (val == '1') { if (val == '1') {
arr1.map((item: any) => { arr1.map((item: any) => {
item.checked = false item.checked = false
}) })
treeRef2.value && treeRef2.value.setCurrentKey(arr2[0]?.id)
emit('changeDeviceType', activeName.value, arr2[0]) emit('changeDeviceType', activeName.value, arr2[0])
setTimeout(() => {
treeRef2.value?.setCurrentKey(arr2[0]?.id)
}, 100)
} }
if (val == '2') { if (val == '2') {
arr3.map((item: any) => { arr3.map((item: any) => {
item.checked = false item.checked = false
}) })
treeRef3.value && treeRef3.value.setCurrentKey(arr3[0]?.id)
emit('changeDeviceType', activeName.value, arr3[0]) emit('changeDeviceType', activeName.value, arr3[0])
setTimeout(() => {
treeRef3.value?.setCurrentKey(arr3[0]?.id)
}, 100)
} }
} }
//治理 //治理

View File

@@ -7,7 +7,7 @@ import { ref, nextTick, onMounted, defineProps } from 'vue'
import Tree from '../index.vue' import Tree from '../index.vue'
import { getLineTree,getCldTree } from '@/api/cs-device-boot/csLedger' import { getLineTree,getCldTree } from '@/api/cs-device-boot/csLedger'
import { useConfig } from '@/stores/config' import { useConfig } from '@/stores/config'
import { getTemplateByDept } from '@/api/harmonic-boot/luckyexcel' import { querySysExcel } from '@/api/harmonic-boot/luckyexcel'
import { useDictData } from '@/stores/dictData' import { useDictData } from '@/stores/dictData'
interface Props { interface Props {
@@ -39,8 +39,8 @@ const info = (selectedNodeId?: string) => {
let rootData = null; let rootData = null;
if (Array.isArray(res.data)) { if (Array.isArray(res.data)) {
// 旧的数据结构 - 数组 // 旧的数据结构 - 数组
rootData = res.data.find((item: any) => item.name == '在线设备'); rootData = res.data.find((item: any) => item.name == '监测设备');
} else if (res.data && res.data.name == '在线设备') { } else if (res.data && res.data.name == '监测设备') {
// 新的数据结构 - 单个对象 // 新的数据结构 - 单个对象
rootData = res.data; rootData = res.data;
} }
@@ -158,7 +158,7 @@ const onAdd = () => {
emit('onAdd') emit('onAdd')
} }
if (props.template) { if (props.template) {
getTemplateByDept({ id: dictData.state.area[0]?.id }) querySysExcel({ id: dictData.state.area[0]?.id })
.then((res: any) => { .then((res: any) => {
emit('Policy', res.data) emit('Policy', res.data)
info() info()

View File

@@ -15,7 +15,7 @@ import { ref, nextTick, onMounted, defineProps } from 'vue'
import Tree from '../index.vue' import Tree from '../index.vue'
import { getLineTree, objTree } from '@/api/cs-device-boot/csLedger' import { getLineTree, objTree } from '@/api/cs-device-boot/csLedger'
import { useConfig } from '@/stores/config' import { useConfig } from '@/stores/config'
import { getTemplateByDept } from '@/api/harmonic-boot/luckyexcel' import { querySysExcel } from '@/api/harmonic-boot/luckyexcel'
import { useDictData } from '@/stores/dictData' import { useDictData } from '@/stores/dictData'
interface Props { interface Props {
@@ -85,7 +85,7 @@ const onAdd = () => {
emit('onAdd') emit('onAdd')
} }
if (props.template) { if (props.template) {
getTemplateByDept({ id: dictData.state.area[0]?.id }) querySysExcel({ id: dictData.state.area[0]?.id })
.then((res: any) => { .then((res: any) => {
emit('Policy', res.data) emit('Policy', res.data)
info() info()

View File

@@ -0,0 +1,179 @@
<template>
<Tree ref="treRef" :width="width" :showPush="props.showPush" :data="tree" default-expand-all @changePointType="changePointType" @onAdd="onAdd"/>
</template>
<script lang="ts" setup>
import { ref, nextTick, onMounted, defineProps } from 'vue'
import Tree from '../index.vue'
import { getLineTree,lineTree } from '@/api/cs-device-boot/csLedger'
import { useConfig } from '@/stores/config'
import { querySysExcel } from '@/api/harmonic-boot/luckyexcel'
import { useDictData } from '@/stores/dictData'
interface Props {
template?: boolean
showPush?: boolean
}
const props = withDefaults(defineProps<Props>(), {
template: false,
showPush: false
})
defineOptions({
name: 'govern/deviceTree'
})
const emit = defineEmits(['init', 'checkChange', 'pointTypeChange', 'Policy','onAdd'])
const config = useConfig()
const tree = ref()
const dictData = useDictData()
const treRef = ref()
const width = ref('')
const info = (selectedNodeId?: string) => {
tree.value = []
let arr1: any[] = []
lineTree().then(res => {
try {
// 检查响应数据结构
let rootData = null;
if (Array.isArray(res.data)) {
// 旧的数据结构 - 数组
rootData = res.data.find((item: any) => item.name == '监测设备');
} else if (res.data && res.data.name == '监测设备') {
// 新的数据结构 - 单个对象
rootData = res.data;
}
// 治理设备
if (rootData) {
rootData.icon = 'el-icon-Menu'
rootData.level = 0
rootData.color = config.getColorVal('elementUiPrimary')
// 确保根节点的 children 是数组
if (!Array.isArray(rootData.children)) {
rootData.children = []
}
rootData.children.forEach((item: any) => {
item.icon = 'el-icon-HomeFilled'
item.level = 1
item.color = config.getColorVal('elementUiPrimary')
// 确保 children 是数组
if (!Array.isArray(item.children)) {
item.children = []
}
item.children.forEach((item2: any) => {
item2.icon = 'el-icon-List'
item2.level = 2
item2.color = config.getColorVal('elementUiPrimary')
// 确保 children 是数组
if (!Array.isArray(item2.children)) {
item2.children = []
}
item2.children.forEach((item3: any) => {
item3.icon = 'el-icon-Platform'
item3.level = 3
item3.color =
item3.comFlag === 2 ? config.getColorVal('elementUiPrimary') : '#e26257 !important'
// 确保 children 是数组
if (!Array.isArray(item3.children)) {
item3.children = []
}
item3.children.forEach((item4: any) => {
item4.icon = 'el-icon-Platform'
item4.level = 4
item4.color =
item4.comFlag === 2 ? config.getColorVal('elementUiPrimary') : '#e26257 !important'
arr1.push(item4)
})
})
})
})
tree.value = [rootData] // 确保 tree.value 是数组
} else {
tree.value = []
}
nextTick(() => {
if (arr1.length) {
// 安全检查 treRef 和 treeRef 是否存在
console.log("🚀 ~ info ~ treRef.value && treRef.value.treeRef && treRef.value.treeRef.setCurrentKey:", treRef.value && treRef.value.treeRef1 && treRef.value.treeRef1.setCurrentKey)
if (treRef.value && treRef.value.treeRef && treRef.value.treeRef.setCurrentKey) {
// 如果传入了要选中的节点ID则选中该节点否则选中第一个节点
console.log('selectedNodeId:', selectedNodeId);
if (selectedNodeId) {
treRef.value.treeRef.setCurrentKey(selectedNodeId);
// 查找对应的节点数据并触发事件
let selectedNode = null;
const findNode = (nodes: any[]) => {
for (const node of nodes) {
if (node.id === selectedNodeId) {
selectedNode = node;
return true;
}
if (node.children && findNode(node.children)) {
return true;
}
}
return false;
};
findNode(tree.value);
if (selectedNode) {
emit('init', {
level: selectedNode.level,
...selectedNode
});
}
} else {
// 初始化选中第一个节点
treRef.value.treeRef.setCurrentKey(arr1[0].id);
emit('init', {
level: 2,
...arr1[0]
});
}
}
} else {
}
})
} catch (error) {
console.error('Error in processing getCldTree response:', error)
}
})
}
const changePointType = (val: any, obj: any) => {
emit('pointTypeChange', val, obj)
}
const onAdd = () => {
emit('onAdd')
}
if (props.template) {
querySysExcel({ id: dictData.state.area[0]?.id })
.then((res: any) => {
emit('Policy', res.data)
info()
})
.catch(err => {
info()
})
} else {
info()
}
// 暴露 info 方法给父组件调用
defineExpose({
info
})
onMounted(() => {})
</script>

View File

@@ -11,10 +11,11 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, nextTick, defineEmits } from 'vue' import { ref, nextTick } from 'vue'
import Tree from '../device.vue' import Tree from '../device.vue'
import { getDeviceTree } from '@/api/cs-device-boot/csLedger' import { getDeviceTree } from '@/api/cs-device-boot/csLedger'
import { useConfig } from '@/stores/config' import { useConfig } from '@/stores/config'
import { throttle } from 'lodash'
defineOptions({ defineOptions({
name: 'govern/deviceTree' name: 'govern/deviceTree'
}) })
@@ -27,7 +28,7 @@ const props = withDefaults(
{ {
showCheckbox: false, showCheckbox: false,
defaultCheckedKeys: [], defaultCheckedKeys: [],
height:0 height: 0
} }
) )
const emit = defineEmits(['init', 'checkChange', 'deviceTypeChange']) const emit = defineEmits(['init', 'checkChange', 'deviceTypeChange'])
@@ -35,7 +36,6 @@ const config = useConfig()
const tree = ref() const tree = ref()
const treRef = ref() const treRef = ref()
const changeDeviceType = (val: any, obj: any) => { const changeDeviceType = (val: any, obj: any) => {
console.log('🚀 ~ changeDeviceType ~ val:', val, obj)
emit('deviceTypeChange', val, obj) emit('deviceTypeChange', val, obj)
} }
getDeviceTree().then(res => { getDeviceTree().then(res => {
@@ -52,6 +52,7 @@ getDeviceTree().then(res => {
item2.icon = 'el-icon-List' item2.icon = 'el-icon-List'
item2.color = config.getColorVal('elementUiPrimary') item2.color = config.getColorVal('elementUiPrimary')
item2.children.forEach((item3: any) => { item2.children.forEach((item3: any) => {
item3.pName = '治理设备'
item3.icon = 'el-icon-Platform' item3.icon = 'el-icon-Platform'
item3.level = 2 item3.level = 2
item3.color = config.getColorVal('elementUiPrimary') item3.color = config.getColorVal('elementUiPrimary')
@@ -68,14 +69,15 @@ getDeviceTree().then(res => {
item.color = config.getColorVal('elementUiPrimary') item.color = config.getColorVal('elementUiPrimary')
item.color = '#e26257 !important' item.color = '#e26257 !important'
item.color = item.comFlag === 2 ? config.getColorVal('elementUiPrimary') : '#e26257 !important' item.color = item.comFlag === 2 ? config.getColorVal('elementUiPrimary') : '#e26257 !important'
// item.disabled =true
item.pName = '便携式设备'
if (item.type == 'device') { if (item.type == 'device') {
arr2.push(item) arr2.push(item)
} }
item.children.forEach((item2: any) => { item.children.forEach((item2: any) => {
item2.icon = 'el-icon-Platform' item2.icon = 'el-icon-Platform'
item2.color = item2.comFlag === 2 ? config.getColorVal('elementUiPrimary') : '#e26257 !important' item2.color = item2.comFlag === 2 ? config.getColorVal('elementUiPrimary') : '#e26257 !important'
item2.pName = '便携式设备'
// item2.children.forEach((item3: any) => { // item2.children.forEach((item3: any) => {
// item3.icon = 'el-icon-Platform' // item3.icon = 'el-icon-Platform'
// item3.color = config.getColorVal('elementUiPrimary') // item3.color = config.getColorVal('elementUiPrimary')
@@ -86,7 +88,7 @@ getDeviceTree().then(res => {
// }) // })
}) })
}) })
} else if (item.name == '在线设备') { } else if (item.name == '监测设备') {
item.children.forEach((item: any) => { item.children.forEach((item: any) => {
item.icon = 'el-icon-HomeFilled' item.icon = 'el-icon-HomeFilled'
item.color = config.getColorVal('elementUiPrimary') item.color = config.getColorVal('elementUiPrimary')
@@ -94,6 +96,7 @@ getDeviceTree().then(res => {
item2.icon = 'el-icon-List' item2.icon = 'el-icon-List'
item2.color = config.getColorVal('elementUiPrimary') item2.color = config.getColorVal('elementUiPrimary')
item2.children.forEach((item3: any) => { item2.children.forEach((item3: any) => {
item3.pName = '监测设备'
item3.icon = 'el-icon-Platform' item3.icon = 'el-icon-Platform'
item3.color = config.getColorVal('elementUiPrimary') item3.color = config.getColorVal('elementUiPrimary')
if (item3.comFlag === 1) { if (item3.comFlag === 1) {
@@ -105,7 +108,6 @@ getDeviceTree().then(res => {
}) })
} }
}) })
console.log('🚀 ~ file: deviceTree.vue ~ line 18 ~ getDeviceTree ~ tree:', arr, arr2, arr3)
tree.value = res.data tree.value = res.data
nextTick(() => { nextTick(() => {
@@ -143,6 +145,22 @@ getDeviceTree().then(res => {
}, 500) }, 500)
}) })
}) })
throttle(
(data: any, checked: any, indeterminate: any) => {
emit('checkChange', {
data,
checked,
indeterminate
})
},
300,
{
leading: true, // 首次触发立即执行(可选,默认 true
trailing: false // 节流结束后是否执行最后一次(可选,默认 true根据需求调整
}
)
const handleCheckChange = (data: any, checked: any, indeterminate: any) => { const handleCheckChange = (data: any, checked: any, indeterminate: any) => {
emit('checkChange', { emit('checkChange', {
data, data,
@@ -150,4 +168,7 @@ const handleCheckChange = (data: any, checked: any, indeterminate: any) => {
indeterminate indeterminate
}) })
} }
defineExpose({
treRef
})
</script> </script>

View File

@@ -7,7 +7,7 @@ import { ref, nextTick, onMounted, defineProps } from 'vue'
import Tree from '../point.vue' import Tree from '../point.vue'
import { getLineTree } from '@/api/cs-device-boot/csLedger' import { getLineTree } from '@/api/cs-device-boot/csLedger'
import { useConfig } from '@/stores/config' import { useConfig } from '@/stores/config'
import { getTemplateByDept } from '@/api/harmonic-boot/luckyexcel' import { querySysExcel } from '@/api/harmonic-boot/luckyexcel'
import { useDictData } from '@/stores/dictData' import { useDictData } from '@/stores/dictData'
// const props = defineProps(['template']) // const props = defineProps(['template'])
interface Props { interface Props {
@@ -71,7 +71,7 @@ const info = () => {
arr2.push(item2) arr2.push(item2)
}) })
}) })
} else if (item.name == '在线设备') { } else if (item.name == '监测设备') {
item.children.forEach((item: any) => { item.children.forEach((item: any) => {
item.icon = 'el-icon-HomeFilled' item.icon = 'el-icon-HomeFilled'
item.level = 1 item.level = 1
@@ -138,7 +138,7 @@ const changePointType = (val: any, obj: any) => {
emit('pointTypeChange', val, obj) emit('pointTypeChange', val, obj)
} }
if (props.template) { if (props.template) {
getTemplateByDept({ id: dictData.state.area[0]?.id }) querySysExcel({ id: dictData.state.area[0]?.id })
.then((res: any) => { .then((res: any) => {
emit('Policy', res.data) emit('Policy', res.data)
info() info()

View File

@@ -53,7 +53,7 @@ import { getSchemeTree, getTestRecordInfo } from '@/api/cs-device-boot/planData'
import { useConfig } from '@/stores/config' import { useConfig } from '@/stores/config'
import useCurrentInstance from '@/utils/useCurrentInstance' import useCurrentInstance from '@/utils/useCurrentInstance'
import { ElTree } from 'element-plus' import { ElTree } from 'element-plus'
import { getTemplateByDept } from '@/api/harmonic-boot/luckyexcel' import { querySysExcel } from '@/api/harmonic-boot/luckyexcel'
import { useDictData } from '@/stores/dictData' import { useDictData } from '@/stores/dictData'
defineOptions({ defineOptions({
name: 'govern/schemeTree' name: 'govern/schemeTree'
@@ -157,7 +157,7 @@ const clickNode = (e: anyObj) => {
} }
if (props.template) { if (props.template) {
getTemplateByDept({ id: dictData.state.area[0]?.id }) querySysExcel({ id: dictData.state.area[0]?.id })
.then((res: any) => { .then((res: any) => {
emit('Policy', res.data) emit('Policy', res.data)
getTreeList() getTreeList()

View File

@@ -33,7 +33,7 @@ const info = () => {
getLineTree().then(res => { getLineTree().then(res => {
//治理设备 //治理设备
res.data.map((item: any) => { res.data.map((item: any) => {
if (item.name == '在线设备') { if (item.name == '监测设备') {
item.children.forEach((item: any) => { item.children.forEach((item: any) => {
item.icon = 'el-icon-HomeFilled' item.icon = 'el-icon-HomeFilled'
item.level = 1 item.level = 1
@@ -59,7 +59,7 @@ const info = () => {
}) })
} }
}) })
tree.value = res.data.filter(item => item.name == '在线设备') tree.value = res.data.filter(item => item.name == '监测设备')
nextTick(() => { nextTick(() => {
if (arr3.length) { if (arr3.length) {
//初始化选中 //初始化选中

View File

@@ -93,7 +93,7 @@
</template> </template>
</el-tree> </el-tree>
</el-collapse-item> </el-collapse-item>
<el-collapse-item title="在线设备" name="2" v-if="yqfDeviceData.length != 0"> <el-collapse-item title="监测设备" name="2" v-if="yqfDeviceData.length != 0">
<el-tree <el-tree
:style="{ height: zlDeviceData.length != 0 ? 'calc(100vh - 340px)' : 'calc(100vh - 238px)' }" :style="{ height: zlDeviceData.length != 0 ? 'calc(100vh - 340px)' : 'calc(100vh - 238px)' }"
ref="treeRef3" ref="treeRef3"
@@ -162,7 +162,7 @@ const zlDeviceData = ref<any>([])
const zlDevList = ref<any>([]) const zlDevList = ref<any>([])
//便携式设备数据 //便携式设备数据
const bxsDeviceData = ref<any>([]) const bxsDeviceData = ref<any>([])
//在线设备数据 //监测设备数据
const yqfDeviceData = ref<any>([]) const yqfDeviceData = ref<any>([])
watch( watch(
() => props.data, () => props.data,
@@ -180,7 +180,7 @@ watch(
item.children.map((vv: any) => { item.children.map((vv: any) => {
bxsDeviceData.value.push(vv) bxsDeviceData.value.push(vv)
}) })
} else if (item.name == '在线设备') { } else if (item.name == '监测设备') {
yqfDeviceData.value = [] yqfDeviceData.value = []
item.children.map((vv: any) => { item.children.map((vv: any) => {
yqfDeviceData.value.push(vv) yqfDeviceData.value.push(vv)
@@ -205,7 +205,7 @@ watch(filterText, val => {
} }
}) })
watch(process, val => { watch(process, val => {
if (val == '' || val == undefined) { if (val == '' || val == undefined) {
zlDevList.value = JSON.parse(JSON.stringify(zlDeviceData.value)) zlDevList.value = JSON.parse(JSON.stringify(zlDeviceData.value))
} else { } else {
zlDevList.value = filterProcess(JSON.parse(JSON.stringify(zlDeviceData.value))) zlDevList.value = filterProcess(JSON.parse(JSON.stringify(zlDeviceData.value)))
@@ -251,22 +251,28 @@ const changeDevice = (val: any) => {
arr2.map((item: any) => { arr2.map((item: any) => {
item.checked = false item.checked = false
}) })
treeRef1?.value && treeRef1.value.setCurrentKey(arr1[0]?.id)
emit('changePointType', activeName.value, arr1[0]) emit('changePointType', activeName.value, arr1[0])
setTimeout(() => {
treeRef1.value?.setCurrentKey(arr1[0]?.id)
}, 100)
} }
if (val == '1') { if (val == '1') {
arr1.map((item: any) => { arr1.map((item: any) => {
item.checked = false item.checked = false
}) })
treeRef2?.value && treeRef2.value.setCurrentKey(arr2[0]?.id)
emit('changePointType', activeName.value, arr2[0]) emit('changePointType', activeName.value, arr2[0])
setTimeout(() => {
treeRef2.value?.setCurrentKey(arr2[0]?.id)
}, 100)
} }
if (val == '2') { if (val == '2') {
arr3.map((item: any) => { arr3.map((item: any) => {
item.checked = false item.checked = false
}) })
treeRef3?.value && treeRef3.value.setCurrentKey(arr3[0]?.id)
emit('changePointType', activeName.value, arr3[0]) emit('changePointType', activeName.value, arr3[0])
setTimeout(() => {
treeRef3.value?.setCurrentKey(arr3[0]?.id)
}, 100)
} }
// if(activeName.value){ // if(activeName.value){
// emit('changePointType', activeName.value) // emit('changePointType', activeName.value)

View File

@@ -218,11 +218,12 @@ const updateNodeCheckStatus = (currentCount: number) => {
const allNodes = treeRef.value.store._getAllNodes() const allNodes = treeRef.value.store._getAllNodes()
allNodes.forEach((node: any) => { allNodes.forEach((node: any) => {
if (node.level === 3) { // 监测点层级 if (node.level === 3) { // 监测点层级
// 如果已达到最大数量且该节点未被选中,则禁用勾选 // 如果已达到最大数量且该节点未被选中,则禁用勾选
if (isMaxSelected && !node.checked) { if (isMaxSelected && !node.data.checked) {
node.disabled = true node.data.disabled = true
} else { } else {
node.disabled = false node.data.disabled = false
} }
} }
}) })

View File

@@ -1,359 +1,359 @@
<template> <template>
<div class="layout-config-drawer"> <div class="layout-config-drawer">
<el-drawer :model-value="configStore.layout.showDrawer" title="布局配置" size="310px" @close="onCloseDrawer"> <el-drawer :model-value="configStore.layout.showDrawer" title="布局配置" size="310px" @close="onCloseDrawer">
<el-scrollbar class="layout-mode-style-scrollbar"> <el-scrollbar class="layout-mode-style-scrollbar">
<el-form ref="formRef" :model="configStore.layout"> <el-form ref="formRef" :model="configStore.layout">
<div class="layout-mode-styles-box"> <div class="layout-mode-styles-box">
<el-divider border-style="dashed">全局</el-divider> <el-divider border-style="dashed">全局</el-divider>
<div class="layout-config-global"> <div class="layout-config-global">
<el-form-item label="后台页面切换动画"> <el-form-item label="后台页面切换动画">
<el-select @change="onCommitState($event, 'mainAnimation')" <el-select @change="onCommitState($event, 'mainAnimation')"
:model-value="configStore.layout.mainAnimation" :model-value="configStore.layout.mainAnimation"
:placeholder="'layouts.Please select an animation name'"> :placeholder="'layouts.Please select an animation name'">
<el-option label="slide-right" value="slide-right"></el-option> <el-option label="slide-right" value="slide-right"></el-option>
<el-option label="slide-left" value="slide-left"></el-option> <el-option label="slide-left" value="slide-left"></el-option>
<el-option label="el-fade-in-linear" value="el-fade-in-linear"></el-option> <el-option label="el-fade-in-linear" value="el-fade-in-linear"></el-option>
<el-option label="el-fade-in" value="el-fade-in"></el-option> <el-option label="el-fade-in" value="el-fade-in"></el-option>
<el-option label="el-zoom-in-center" value="el-zoom-in-center"></el-option> <el-option label="el-zoom-in-center" value="el-zoom-in-center"></el-option>
<el-option label="el-zoom-in-top" value="el-zoom-in-top"></el-option> <el-option label="el-zoom-in-top" value="el-zoom-in-top"></el-option>
<el-option label="el-zoom-in-bottom" value="el-zoom-in-bottom"></el-option> <el-option label="el-zoom-in-bottom" value="el-zoom-in-bottom"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="组件主题色"> <el-form-item label="组件主题色">
<el-color-picker @change="onCommitColorState($event, 'elementUiPrimary')" <el-color-picker @change="onCommitColorState($event, 'elementUiPrimary')"
:model-value="configStore.getColorVal('elementUiPrimary')" /> :model-value="configStore.getColorVal('elementUiPrimary')" />
</el-form-item> </el-form-item>
<el-form-item label="表格标题栏背景颜色"> <el-form-item label="表格标题栏背景颜色">
<el-color-picker @change="onCommitColorState($event, 'tableHeaderBackground')" <el-color-picker @change="onCommitColorState($event, 'tableHeaderBackground')"
:model-value="configStore.getColorVal('tableHeaderBackground')" /> :model-value="configStore.getColorVal('tableHeaderBackground')" />
</el-form-item> </el-form-item>
<el-form-item label="表格标题栏文字颜色"> <el-form-item label="表格标题栏文字颜色">
<el-color-picker @change="onCommitColorState($event, 'tableHeaderColor')" <el-color-picker @change="onCommitColorState($event, 'tableHeaderColor')"
:model-value="configStore.getColorVal('tableHeaderColor')" /> :model-value="configStore.getColorVal('tableHeaderColor')" />
</el-form-item> </el-form-item>
<el-form-item label="表格激活栏颜色"> <el-form-item label="表格激活栏颜色">
<el-color-picker @change="onCommitColorState($event, 'tableCurrent')" <el-color-picker @change="onCommitColorState($event, 'tableCurrent')"
:model-value="configStore.getColorVal('tableCurrent')" /> :model-value="configStore.getColorVal('tableCurrent')" />
</el-form-item> </el-form-item>
</div> </div>
<el-divider border-style="dashed">侧边栏</el-divider> <el-divider border-style="dashed">侧边栏</el-divider>
<div class="layout-config-aside"> <div class="layout-config-aside">
<el-form-item label="侧边菜单栏背景色"> <el-form-item label="侧边菜单栏背景色">
<el-color-picker @change="onCommitColorState($event, 'menuBackground')" <el-color-picker @change="onCommitColorState($event, 'menuBackground')"
:model-value="configStore.getColorVal('menuBackground')" /> :model-value="configStore.getColorVal('menuBackground')" />
</el-form-item> </el-form-item>
<el-form-item label="侧边菜单文字颜色"> <el-form-item label="侧边菜单文字颜色">
<el-color-picker @change="onCommitColorState($event, 'menuColor')" <el-color-picker @change="onCommitColorState($event, 'menuColor')"
:model-value="configStore.getColorVal('menuColor')" /> :model-value="configStore.getColorVal('menuColor')" />
</el-form-item> </el-form-item>
<el-form-item label="侧边菜单激活项背景色"> <el-form-item label="侧边菜单激活项背景色">
<el-color-picker @change="onCommitColorState($event, 'menuActiveBackground')" <el-color-picker @change="onCommitColorState($event, 'menuActiveBackground')"
:model-value="configStore.getColorVal('menuActiveBackground')" /> :model-value="configStore.getColorVal('menuActiveBackground')" />
</el-form-item> </el-form-item>
<el-form-item label="侧边菜单激活项文字色"> <el-form-item label="侧边菜单激活项文字色">
<el-color-picker @change="onCommitColorState($event, 'menuActiveColor')" <el-color-picker @change="onCommitColorState($event, 'menuActiveColor')"
:model-value="configStore.getColorVal('menuActiveColor')" /> :model-value="configStore.getColorVal('menuActiveColor')" />
</el-form-item> </el-form-item>
<el-form-item label="显示侧边菜单顶栏(LOGO栏)"> <el-form-item label="显示侧边菜单顶栏(LOGO栏)">
<el-switch @change="onCommitState($event, 'menuShowTopBar')" <el-switch @change="onCommitState($event, 'menuShowTopBar')"
:model-value="configStore.layout.menuShowTopBar"></el-switch> :model-value="configStore.layout.menuShowTopBar"></el-switch>
</el-form-item> </el-form-item>
<el-form-item label="侧边菜单顶栏背景色"> <el-form-item label="侧边菜单顶栏背景色">
<el-color-picker @change="onCommitColorState($event, 'menuTopBarBackground')" <el-color-picker @change="onCommitColorState($event, 'menuTopBarBackground')"
:model-value="configStore.getColorVal('menuTopBarBackground')" /> :model-value="configStore.getColorVal('menuTopBarBackground')" />
</el-form-item> </el-form-item>
<el-form-item label="侧边菜单宽度(展开时)"> <el-form-item label="侧边菜单宽度(展开时)">
<el-input maxlength="32" show-word-limit @input="onCommitState($event, 'menuWidth')" <el-input maxlength="32" show-word-limit @input="onCommitState($event, 'menuWidth')"
type="number" :step="10" :model-value="configStore.layout.menuWidth"> type="number" :step="10" :model-value="configStore.layout.menuWidth">
<template #append>px</template> <template #append>px</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<!-- <el-form-item label="侧边菜单默认图标">--> <!-- <el-form-item label="侧边菜单默认图标">-->
<!-- <IconSelector--> <!-- <IconSelector-->
<!-- @change="onCommitMenuDefaultIcon($event, 'menuDefaultIcon')"--> <!-- @change="onCommitMenuDefaultIcon($event, 'menuDefaultIcon')"-->
<!-- :model-value="configStore.layout.menuDefaultIcon"--> <!-- :model-value="configStore.layout.menuDefaultIcon"-->
<!-- />--> <!-- />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- <el-form-item label="侧边菜单水平折叠">--> <!-- <el-form-item label="侧边菜单水平折叠">-->
<!-- <el-switch--> <!-- <el-switch-->
<!-- @change="onCommitState($event, 'menuCollapse')"--> <!-- @change="onCommitState($event, 'menuCollapse')"-->
<!-- :model-value="configStore.layout.menuCollapse"--> <!-- :model-value="configStore.layout.menuCollapse"-->
<!-- ></el-switch>--> <!-- ></el-switch>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- <el-form-item label="侧边菜单手风琴">--> <!-- <el-form-item label="侧边菜单手风琴">-->
<!-- <el-switch--> <!-- <el-switch-->
<!-- @change="onCommitState($event, 'menuUniqueOpened')"--> <!-- @change="onCommitState($event, 'menuUniqueOpened')"-->
<!-- :model-value="configStore.layout.menuUniqueOpened"--> <!-- :model-value="configStore.layout.menuUniqueOpened"-->
<!-- ></el-switch>--> <!-- ></el-switch>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
</div> </div>
<el-divider border-style="dashed">顶栏</el-divider> <el-divider border-style="dashed">顶栏</el-divider>
<div class="layout-config-aside"> <div class="layout-config-aside">
<el-form-item label="顶栏背景色"> <el-form-item label="顶栏背景色">
<el-color-picker @change="onCommitColorState($event, 'headerBarBackground')" <el-color-picker @change="onCommitColorState($event, 'headerBarBackground')"
:model-value="configStore.getColorVal('headerBarBackground')" /> :model-value="configStore.getColorVal('headerBarBackground')" />
</el-form-item> </el-form-item>
<el-form-item label="顶栏文字色"> <el-form-item label="顶栏文字色">
<el-color-picker @change="onCommitColorState($event, 'headerBarTabColor')" <el-color-picker @change="onCommitColorState($event, 'headerBarTabColor')"
:model-value="configStore.getColorVal('headerBarTabColor')" /> :model-value="configStore.getColorVal('headerBarTabColor')" />
</el-form-item> </el-form-item>
<!-- <el-form-item label="顶栏悬停时背景色">--> <!-- <el-form-item label="顶栏悬停时背景色">-->
<!-- <el-color-picker--> <!-- <el-color-picker-->
<!-- @change="onCommitColorState($event, 'headerBarHoverBackground')"--> <!-- @change="onCommitColorState($event, 'headerBarHoverBackground')"-->
<!-- :model-value="configStore.getColorVal('headerBarHoverBackground')"--> <!-- :model-value="configStore.getColorVal('headerBarHoverBackground')"-->
<!-- />--> <!-- />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- <el-form-item label="顶栏菜单激活项背景色">--> <!-- <el-form-item label="顶栏菜单激活项背景色">-->
<!-- <el-color-picker--> <!-- <el-color-picker-->
<!-- @change="onCommitColorState($event, 'headerBarTabActiveBackground')"--> <!-- @change="onCommitColorState($event, 'headerBarTabActiveBackground')"-->
<!-- :model-value="configStore.getColorVal('headerBarTabActiveBackground')"--> <!-- :model-value="configStore.getColorVal('headerBarTabActiveBackground')"-->
<!-- />--> <!-- />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- <el-form-item label="顶栏菜单激活项文字色">--> <!-- <el-form-item label="顶栏菜单激活项文字色">-->
<!-- <el-color-picker--> <!-- <el-color-picker-->
<!-- @change="onCommitColorState($event, 'headerBarTabActiveColor')"--> <!-- @change="onCommitColorState($event, 'headerBarTabActiveColor')"-->
<!-- :model-value="configStore.getColorVal('headerBarTabActiveColor')"--> <!-- :model-value="configStore.getColorVal('headerBarTabActiveColor')"-->
<!-- />--> <!-- />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
</div> </div>
<el-popconfirm @confirm="restoreDefault" title="确定要恢复全部配置到默认值吗?"> <el-popconfirm @confirm="restoreDefault" title="确定要恢复全部配置到默认值吗?">
<template #reference> <template #reference>
<div class="ba-center"> <div class="ba-center">
<el-button class="w80" type="info">恢复默认</el-button> <el-button class="w80" type="info">恢复默认</el-button>
</div> </div>
</template> </template>
</el-popconfirm> </el-popconfirm>
</div> </div>
</el-form> </el-form>
</el-scrollbar> </el-scrollbar>
</el-drawer> </el-drawer>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useConfig } from '@/stores/config' import { useConfig } from '@/stores/config'
import { useNavTabs } from '@/stores/navTabs' import { useNavTabs } from '@/stores/navTabs'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import IconSelector from '@/components/baInput/components/iconSelector.vue' import IconSelector from '@/components/baInput/components/iconSelector.vue'
import { STORE_CONFIG } from '@/stores/constant/cacheKey' import { STORE_CONFIG } from '@/stores/constant/cacheKey'
import { Local, Session } from '@/utils/storage' import { Local, Session } from '@/utils/storage'
import type { Layout } from '@/stores/interface' import type { Layout } from '@/stores/interface'
const configStore = useConfig() const configStore = useConfig()
const navTabs = useNavTabs() const navTabs = useNavTabs()
const router = useRouter() const router = useRouter()
const onCommitState = (value: any, name: any) => { const onCommitState = (value: any, name: any) => {
configStore.setLayout(name, value) configStore.setLayout(name, value)
} }
const onCommitColorState = (value: string | null, name: keyof Layout) => { const onCommitColorState = (value: string | null, name: keyof Layout) => {
if (value === null) return if (value === null) return
const colors = configStore.layout[name] as string[] const colors = configStore.layout[name] as string[]
if (configStore.layout.isDark) { if (configStore.layout.isDark) {
colors[1] = value colors[1] = value
} else { } else {
colors[0] = value colors[0] = value
} }
configStore.setLayout(name, colors) configStore.setLayout(name, colors)
} }
const setLayoutMode = (mode: string) => { const setLayoutMode = (mode: string) => {
configStore.setLayoutMode(mode) configStore.setLayoutMode(mode)
} }
// 修改默认菜单图标 // 修改默认菜单图标
const onCommitMenuDefaultIcon = (value: any, name: any) => { const onCommitMenuDefaultIcon = (value: any, name: any) => {
configStore.setLayout(name, value) configStore.setLayout(name, value)
const menus = navTabs.state.tabsViewRoutes const menus = navTabs.state.tabsViewRoutes
navTabs.setTabsViewRoutes([]) navTabs.setTabsViewRoutes([])
setTimeout(() => { setTimeout(() => {
navTabs.setTabsViewRoutes(menus) navTabs.setTabsViewRoutes(menus)
}, 200) }, 200)
} }
const onCloseDrawer = () => { const onCloseDrawer = () => {
configStore.setLayout('showDrawer', false) configStore.setLayout('showDrawer', false)
} }
const restoreDefault = () => { const restoreDefault = () => {
Local.remove(STORE_CONFIG) Local.remove(STORE_CONFIG)
router.go(0) router.go(0)
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.layout-config-drawer :deep(.el-input__inner) { .layout-config-drawer :deep(.el-input__inner) {
padding: 0 0 0 6px; padding: 0 0 0 6px;
} }
.layout-config-drawer :deep(.el-input-group__append) { .layout-config-drawer :deep(.el-input-group__append) {
padding: 0 10px; padding: 0 10px;
} }
.layout-config-drawer :deep(.el-drawer__header) { .layout-config-drawer :deep(.el-drawer__header) {
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }
.layout-config-drawer :deep(.el-drawer__body) { .layout-config-drawer :deep(.el-drawer__body) {
padding: 0; padding: 0;
} }
.layout-mode-styles-box { .layout-mode-styles-box {
padding: 20px; padding: 20px;
} }
.layout-mode-box-style-row { .layout-mode-box-style-row {
margin-bottom: 15px; margin-bottom: 15px;
} }
.layout-mode-style { .layout-mode-style {
position: relative; position: relative;
height: 100px; height: 100px;
border: 1px solid var(--el-border-color-light); border: 1px solid var(--el-border-color-light);
border-radius: var(--el-border-radius-small); border-radius: var(--el-border-radius-small);
&:hover, &:hover,
&.active { &.active {
border: 1px solid var(--el-color-primary); border: 1px solid var(--el-color-primary);
} }
.layout-mode-style-name { .layout-mode-style-name {
position: absolute; position: absolute;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
color: var(--el-color-primary-light-5); color: var(--el-color-primary-light-5);
border-radius: 50%; border-radius: 50%;
height: 50px; height: 50px;
width: 50px; width: 50px;
border: 1px solid var(--el-color-primary-light-3); border: 1px solid var(--el-color-primary-light-3);
} }
.layout-mode-style-box { .layout-mode-style-box {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
&.default { &.default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.layout-mode-style-aside { .layout-mode-style-aside {
width: 18%; width: 18%;
height: 90%; height: 90%;
background-color: var(--el-border-color-lighter); background-color: var(--el-border-color-lighter);
} }
.layout-mode-style-container-box { .layout-mode-style-container-box {
width: 68%; width: 68%;
height: 90%; height: 90%;
margin-left: 4%; margin-left: 4%;
.layout-mode-style-header { .layout-mode-style-header {
width: 100%; width: 100%;
height: 10%; height: 10%;
background-color: var(--el-border-color-lighter); background-color: var(--el-border-color-lighter);
} }
.layout-mode-style-container { .layout-mode-style-container {
width: 100%; width: 100%;
height: 85%; height: 85%;
background-color: var(--el-border-color-extra-light); background-color: var(--el-border-color-extra-light);
margin-top: 5%; margin-top: 5%;
} }
} }
} }
&.classic { &.classic {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.layout-mode-style-aside { .layout-mode-style-aside {
width: 18%; width: 18%;
height: 100%; height: 100%;
background-color: var(--el-border-color-lighter); background-color: var(--el-border-color-lighter);
} }
.layout-mode-style-container-box { .layout-mode-style-container-box {
width: 82%; width: 82%;
height: 100%; height: 100%;
.layout-mode-style-header { .layout-mode-style-header {
width: 100%; width: 100%;
height: 10%; height: 10%;
background-color: var(--el-border-color); background-color: var(--el-border-color);
} }
.layout-mode-style-container { .layout-mode-style-container {
width: 100%; width: 100%;
height: 90%; height: 90%;
background-color: var(--el-border-color-extra-light); background-color: var(--el-border-color-extra-light);
} }
} }
} }
&.streamline { &.streamline {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.layout-mode-style-container-box { .layout-mode-style-container-box {
width: 100%; width: 100%;
height: 100%; height: 100%;
.layout-mode-style-header { .layout-mode-style-header {
width: 100%; width: 100%;
height: 10%; height: 10%;
background-color: var(--el-border-color); background-color: var(--el-border-color);
} }
.layout-mode-style-container { .layout-mode-style-container {
width: 100%; width: 100%;
height: 90%; height: 90%;
background-color: var(--el-border-color-extra-light); background-color: var(--el-border-color-extra-light);
} }
} }
} }
&.double { &.double {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.layout-mode-style-aside { .layout-mode-style-aside {
width: 18%; width: 18%;
height: 100%; height: 100%;
background-color: var(--el-border-color); background-color: var(--el-border-color);
} }
.layout-mode-style-container-box { .layout-mode-style-container-box {
width: 82%; width: 82%;
height: 100%; height: 100%;
.layout-mode-style-header { .layout-mode-style-header {
width: 100%; width: 100%;
height: 10%; height: 10%;
background-color: var(--el-border-color); background-color: var(--el-border-color);
} }
.layout-mode-style-container { .layout-mode-style-container {
width: 100%; width: 100%;
height: 90%; height: 90%;
background-color: var(--el-border-color-extra-light); background-color: var(--el-border-color-extra-light);
} }
} }
} }
} }
.w80 { .w80 {
width: 90%; width: 90%;
} }
</style> </style>

View File

@@ -1,81 +1,81 @@
<template> <template>
<el-scrollbar ref="verticalMenusRef" class="vertical-menus-scrollbar"> <el-scrollbar ref="verticalMenusRef" class="vertical-menus-scrollbar">
<el-menu <el-menu
class="layouts-menu-vertical" class="layouts-menu-vertical"
:collapse-transition="false" :collapse-transition="false"
:unique-opened="config.layout.menuUniqueOpened" :unique-opened="config.layout.menuUniqueOpened"
:default-active="state.defaultActive" :default-active="state.defaultActive"
:collapse="config.layout.menuCollapse" :collapse="config.layout.menuCollapse"
> >
<MenuTree :menus="navTabs.state.tabsViewRoutes" /> <MenuTree :menus="navTabs.state.tabsViewRoutes" />
</el-menu> </el-menu>
</el-scrollbar> </el-scrollbar>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, nextTick, onMounted, reactive, ref } from 'vue' import { computed, nextTick, onMounted, reactive, ref } from 'vue'
import MenuTree from '@/layouts/admin/components/menus/menuTree.vue' import MenuTree from '@/layouts/admin/components/menus/menuTree.vue'
import { useRoute, onBeforeRouteUpdate, type RouteLocationNormalizedLoaded } from 'vue-router' import { useRoute, onBeforeRouteUpdate, type RouteLocationNormalizedLoaded } from 'vue-router'
import type { ScrollbarInstance } from 'element-plus' import type { ScrollbarInstance } from 'element-plus'
import { useConfig } from '@/stores/config' import { useConfig } from '@/stores/config'
import { useNavTabs } from '@/stores/navTabs' import { useNavTabs } from '@/stores/navTabs'
const config = useConfig() const config = useConfig()
const navTabs = useNavTabs() const navTabs = useNavTabs()
const route = useRoute() const route = useRoute()
const verticalMenusRef = ref<ScrollbarInstance>() const verticalMenusRef = ref<ScrollbarInstance>()
const state = reactive({ const state = reactive({
defaultActive: '', defaultActive: '',
}) })
const verticalMenusScrollbarHeight = computed(() => { const verticalMenusScrollbarHeight = computed(() => {
let menuTopBarHeight = 0 let menuTopBarHeight = 0
if (config.layout.menuShowTopBar) { if (config.layout.menuShowTopBar) {
menuTopBarHeight = 50 menuTopBarHeight = 50
} }
if (config.layout.layoutMode == 'Default') { if (config.layout.layoutMode == 'Default') {
return 'calc(100vh - ' + (32 + menuTopBarHeight) + 'px)' return 'calc(100vh - ' + (32 + menuTopBarHeight) + 'px)'
} else { } else {
return 'calc(100vh - ' + menuTopBarHeight + 'px)' return 'calc(100vh - ' + menuTopBarHeight + 'px)'
} }
}) })
// 激活当前路由的菜单 // 激活当前路由的菜单
const currentRouteActive = (currentRoute: RouteLocationNormalizedLoaded) => { const currentRouteActive = (currentRoute: RouteLocationNormalizedLoaded) => {
state.defaultActive = currentRoute.path state.defaultActive = currentRoute.path
} }
// 滚动条滚动到激活菜单所在位置 // 滚动条滚动到激活菜单所在位置
const verticalMenusScroll = () => { const verticalMenusScroll = () => {
nextTick(() => { nextTick(() => {
let activeMenu: HTMLElement | null = document.querySelector('.el-menu.layouts-menu-vertical li.is-active') let activeMenu: HTMLElement | null = document.querySelector('.el-menu.layouts-menu-vertical li.is-active')
if (!activeMenu) return false if (!activeMenu) return false
verticalMenusRef.value?.setScrollTop(activeMenu.offsetTop) verticalMenusRef.value?.setScrollTop(activeMenu.offsetTop)
}) })
} }
onMounted(() => { onMounted(() => {
currentRouteActive(route) currentRouteActive(route)
verticalMenusScroll() verticalMenusScroll()
}) })
onBeforeRouteUpdate((to) => { onBeforeRouteUpdate((to) => {
currentRouteActive(to) currentRouteActive(to)
}) })
</script> </script>
<style> <style>
.vertical-menus-scrollbar { .vertical-menus-scrollbar {
height: v-bind(verticalMenusScrollbarHeight); height: v-bind(verticalMenusScrollbarHeight);
background-color: v-bind('config.getColorVal("menuBackground")'); background-color: v-bind('config.getColorVal("menuBackground")');
} }
.layouts-menu-vertical { .layouts-menu-vertical {
border: 0; border: 0;
padding-bottom: 30px; padding-bottom: 30px;
--el-menu-bg-color: v-bind('config.getColorVal("menuBackground")'); --el-menu-bg-color: v-bind('config.getColorVal("menuBackground")');
--el-menu-text-color: v-bind('config.getColorVal("menuColor")'); --el-menu-text-color: v-bind('config.getColorVal("menuColor")');
--el-menu-active-color: v-bind('config.getColorVal("menuActiveColor")'); --el-menu-active-color: v-bind('config.getColorVal("menuActiveColor")');
--el-menu-hover-color: v-bind('config.getColorVal("menuActiveBackground")'); --el-menu-hover-color: v-bind('config.getColorVal("menuActiveBackground")');
} }
</style> </style>

View File

@@ -214,8 +214,8 @@ onMounted(() => {
overflow-x: auto; overflow-x: auto;
overflow-y: hidden; overflow-y: hidden;
margin-right: var(--ba-main-space); margin-right: var(--ba-main-space);
scrollbar-width: none; // scrollbar-width: none;
// overflow-x: auto;
&::-webkit-scrollbar { &::-webkit-scrollbar {
height: 5px; height: 5px;
} }

View File

@@ -1,238 +1,241 @@
<template> <template>
<div class="nav-menus" :class="configStore.layout.layoutMode"> <div class="nav-menus" :class="configStore.layout.layoutMode">
<div @click="savePng" class="nav-menu-item"> <!-- <div @click="savePng" class="nav-menu-item">
<Icon <Icon
:color="configStore.getColorVal('headerBarTabColor')" :color="configStore.getColorVal('headerBarTabColor')"
class="nav-menu-icon" class="nav-menu-icon"
name="el-icon-Camera" name="el-icon-Camera"
size="18" size="18"
/> />
</div> </div>
<div @click="onFullScreen" class="nav-menu-item" :class="state.isFullScreen ? 'hover' : ''"> <div @click="onFullScreen" class="nav-menu-item" :class="state.isFullScreen ? 'hover' : ''">
<Icon <Icon
:color="configStore.getColorVal('headerBarTabColor')" :color="configStore.getColorVal('headerBarTabColor')"
class="nav-menu-icon" class="nav-menu-icon"
v-if="state.isFullScreen" v-if="state.isFullScreen"
name="fa-solid fa-compress" name="fa-solid fa-compress"
size="18" size="18"
/> />
<Icon <Icon
:color="configStore.getColorVal('headerBarTabColor')" :color="configStore.getColorVal('headerBarTabColor')"
class="nav-menu-icon" class="nav-menu-icon"
v-else v-else
name="fa-solid fa-expand" name="fa-solid fa-expand"
size="18" size="18"
/> />
</div> </div> -->
<el-dropdown style="height: 100%" @command="handleCommand"> <el-dropdown style="height: 100%" @command="handleCommand">
<div class="admin-info" :class="state.currentNavMenu == 'adminInfo' ? 'hover' : ''"> <div class="admin-info" :class="state.currentNavMenu == 'adminInfo' ? 'hover' : ''">
<el-avatar :size="25" fit="fill"> <el-avatar :size="25" fit="fill">
<img src="@/assets/avatar.png" alt="" /> <img src="@/assets/avatar.png" alt="" />
</el-avatar> </el-avatar>
<div class="admin-name">{{ adminInfo.nickname }}</div> <div class="admin-name">{{ adminInfo.nickname }}</div>
</div> </div>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item command="adminInfo">个人资料</el-dropdown-item> <el-dropdown-item command="adminInfo">个人资料</el-dropdown-item>
<el-dropdown-item command="changePwd">修改密码</el-dropdown-item> <el-dropdown-item command="changePwd">修改密码</el-dropdown-item>
<el-dropdown-item command="layout">退出登录</el-dropdown-item> <el-dropdown-item command="layout">退出登录</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
<!-- <div @click="configStore.setLayout('showDrawer', true)" class="nav-menu-item"> <!-- <div @click="configStore.setLayout('showDrawer', true)" class="nav-menu-item">
<Icon <Icon
:color="configStore.getColorVal('headerBarTabColor')" :color="configStore.getColorVal('headerBarTabColor')"
class="nav-menu-icon" class="nav-menu-icon"
name="fa fa-cogs" name="fa fa-cogs"
size="18" size="18"
/> />
</div> -->" </div> -->
"
<Config />
<PopupPwd ref="popupPwd" /> <Config />
<AdminInfo ref="popupAdminInfo" /> <PopupPwd ref="popupPwd" />
<!-- <TerminalVue /> --> <AdminInfo ref="popupAdminInfo" />
</div> <!-- <TerminalVue /> -->
</template> </div>
</template>
<script lang="ts" setup>
import { reactive, ref } from 'vue' <script lang="ts" setup>
import screenfull from 'screenfull' import { reactive, ref } from 'vue'
import { useConfig } from '@/stores/config' import screenfull from 'screenfull'
import { ElMessage } from 'element-plus' import { useConfig } from '@/stores/config'
import Config from './config.vue' import { ElMessage } from 'element-plus'
import { useAdminInfo } from '@/stores/adminInfo' import Config from './config.vue'
import router from '@/router' import { useAdminInfo } from '@/stores/adminInfo'
import { routePush } from '@/utils/router' import router from '@/router'
import { fullUrl } from '@/utils/common' import { routePush } from '@/utils/router'
import html2canvas from 'html2canvas' import { fullUrl } from '@/utils/common'
import PopupPwd from './popup/password.vue' import html2canvas from 'html2canvas'
import AdminInfo from './popup/adminInfo.vue' import PopupPwd from './popup/password.vue'
import { useNavTabs } from '@/stores/navTabs' import AdminInfo from './popup/adminInfo.vue'
import { useNavTabs } from '@/stores/navTabs'
const adminInfo = useAdminInfo() const adminInfo = useAdminInfo()
const navTabs = useNavTabs() const navTabs = useNavTabs()
const configStore = useConfig() const configStore = useConfig()
const popupPwd = ref() const popupPwd = ref()
const popupAdminInfo = ref() const popupAdminInfo = ref()
const state = reactive({ const state = reactive({
isFullScreen: false, isFullScreen: false,
currentNavMenu: '', currentNavMenu: '',
showLayoutDrawer: false, showLayoutDrawer: false,
showAdminInfoPopover: false showAdminInfoPopover: false
}) })
const savePng = () => { const savePng = () => {
html2canvas(document.body, { html2canvas(document.body, {
scale: 1, scale: 1,
useCORS: true useCORS: true
}).then(function (canvas) { }).then(function (canvas) {
var link = document.createElement('a') var link = document.createElement('a')
link.href = canvas.toDataURL('image/png') link.href = canvas.toDataURL('image/png')
link.download = 'screenshot.png' link.download = 'screenshot.png'
link.click() link.click()
}) })
} }
const onFullScreen = () => { const onFullScreen = () => {
if (!screenfull.isEnabled) { if (!screenfull.isEnabled) {
ElMessage.warning('layouts.Full screen is not supported') ElMessage.warning('layouts.Full screen is not supported')
return false return false
} }
screenfull.toggle() screenfull.toggle()
screenfull.onchange(() => { screenfull.onchange(() => {
state.isFullScreen = screenfull.isFullscreen state.isFullScreen = screenfull.isFullscreen
}) })
} }
const handleCommand = (key: string) => { const handleCommand = async (key: string) => {
// console.log(key) // console.log(key)
switch (key) { switch (key) {
case 'adminInfo': case 'adminInfo':
popupAdminInfo.value.open() popupAdminInfo.value.open()
break break
case 'changePwd': case 'changePwd':
popupPwd.value.open() popupPwd.value.open()
break break
case 'layout': case 'layout':
navTabs.closeTabs() await window.location.reload()
window.localStorage.clear() setTimeout(() => {
adminInfo.reset() navTabs.closeTabs()
router.push({ name: 'login' }) window.localStorage.clear()
break adminInfo.reset()
default: router.push({ name: 'login' })
break }, 0)
} break
} default:
</script> break
}
<style scoped lang="scss"> }
.nav-menus.Default { </script>
border-radius: var(--el-border-radius-base);
box-shadow: var(--el-box-shadow-light); <style scoped lang="scss">
} .nav-menus.Default {
border-radius: var(--el-border-radius-base);
.nav-menus { box-shadow: var(--el-box-shadow-light);
display: flex; }
align-items: center;
height: 100%; .nav-menus {
margin-left: auto; display: flex;
background-color: v-bind('configStore.getColorVal("headerBarBackground")'); align-items: center;
height: 100%;
.nav-menu-item { margin-left: auto;
height: 100%; background-color: v-bind('configStore.getColorVal("headerBarBackground")');
width: 40px;
display: flex; .nav-menu-item {
align-items: center; height: 100%;
justify-content: center; width: 40px;
cursor: pointer; display: flex;
align-items: center;
.nav-menu-icon { justify-content: center;
box-sizing: content-box; cursor: pointer;
color: v-bind('configStore.getColorVal("headerBarTabColor")');
} .nav-menu-icon {
box-sizing: content-box;
&:hover { color: v-bind('configStore.getColorVal("headerBarTabColor")');
.icon { }
animation: twinkle 0.3s ease-in-out;
} &:hover {
} .icon {
} animation: twinkle 0.3s ease-in-out;
}
.admin-info { }
display: flex; }
height: 100%;
padding: 0 10px; .admin-info {
align-items: center; display: flex;
cursor: pointer; height: 100%;
user-select: none; padding: 0 10px;
color: v-bind('configStore.getColorVal("headerBarTabColor")'); align-items: center;
cursor: pointer;
&:hover { user-select: none;
color: v-bind('configStore.getColorVal("headerBarTabActiveColor")'); color: v-bind('configStore.getColorVal("headerBarTabColor")');
}
} &:hover {
color: v-bind('configStore.getColorVal("headerBarTabActiveColor")');
.admin-name { }
padding-left: 6px; }
white-space: nowrap;
} .admin-name {
padding-left: 6px;
.nav-menu-item:hover, white-space: nowrap;
.admin-info:hover, }
.nav-menu-item.hover,
.admin-info.hover { .nav-menu-item:hover,
background: v-bind('configStore.getColorVal("headerBarHoverBackground")'); .admin-info:hover,
.nav-menu-item.hover,
.nav-menu-icon { .admin-info.hover {
color: v-bind('configStore.getColorVal("headerBarTabActiveColor")') !important; background: v-bind('configStore.getColorVal("headerBarHoverBackground")');
}
} .nav-menu-icon {
} color: v-bind('configStore.getColorVal("headerBarTabActiveColor")') !important;
}
.dropdown-menu-box :deep(.el-dropdown-menu__item) { }
justify-content: center; }
}
.dropdown-menu-box :deep(.el-dropdown-menu__item) {
.admin-info-base { justify-content: center;
display: flex; }
justify-content: center;
flex-wrap: wrap; .admin-info-base {
padding-top: 10px; display: flex;
justify-content: center;
.admin-info-other { flex-wrap: wrap;
display: block; padding-top: 10px;
width: 100%;
text-align: center; .admin-info-other {
padding: 10px 0; display: block;
width: 100%;
.admin-info-name { text-align: center;
font-size: var(--el-font-size-large); padding: 10px 0;
}
} .admin-info-name {
} font-size: var(--el-font-size-large);
}
.admin-info-footer { }
padding: 10px 0; }
margin: 0 -12px -12px -12px;
display: flex; .admin-info-footer {
justify-content: space-around; padding: 10px 0;
} margin: 0 -12px -12px -12px;
display: flex;
.pt2 { justify-content: space-around;
padding-top: 2px; }
}
.pt2 {
@keyframes twinkle { padding-top: 2px;
0% { }
transform: scale(0);
} @keyframes twinkle {
80% { 0% {
transform: scale(1.2); transform: scale(0);
} }
100% { 80% {
transform: scale(1); transform: scale(1.2);
} }
} 100% {
</style> transform: scale(1);
}
}
</style>

View File

@@ -1,109 +1,123 @@
<template> <template>
<el-dialog draggable width="500px" v-model.trim="dialogVisible" :title="title"> <el-dialog draggable width="500px" v-model.trim="dialogVisible" :title="title">
<el-scrollbar> <el-scrollbar>
<el-form :inline="false" :model="form" label-width="120px" :rules="rules" class="form-one" ref="formRef"> <el-form :inline="false" :model="form" label-width="120px" :rules="rules" class="form-one" ref="formRef">
<el-form-item label="校验密码:" prop="password"> <el-form-item label="校验密码:" prop="password">
<el-input v-model.trim="form.password" type="password" placeholder="请输入校验密码" show-password /> <el-input v-model.trim="form.password" type="password" placeholder="请输入校验密码" show-password />
</el-form-item> </el-form-item>
<el-form-item label="新密码:" prop="newPwd"> <el-form-item label="新密码:" prop="newPwd">
<el-input v-model.trim="form.newPwd" type="password" placeholder="请输入新密码" show-password /> <el-input v-model.trim="form.newPwd" type="password" placeholder="请输入新密码" show-password />
</el-form-item> </el-form-item>
<el-form-item label="确认密码:" prop="confirmPwd"> <el-form-item label="确认密码:" prop="confirmPwd">
<el-input v-model.trim="form.confirmPwd" type="password" placeholder="请输入确认密码" show-password /> <el-input
</el-form-item> v-model.trim="form.confirmPwd"
</el-form> type="password"
</el-scrollbar> placeholder="请输入确认密码"
<template #footer> show-password
<span class="dialog-footer"> />
<el-button @click="dialogVisible = false">取消</el-button> </el-form-item>
<el-button type="primary" @click="submit">确认</el-button> </el-form>
</span> </el-scrollbar>
</template> <template #footer>
</el-dialog> <span class="dialog-footer">
</template> <el-button @click="dialogVisible = false">取消</el-button>
<script lang="ts" setup> <el-button type="primary" @click="submit">确认</el-button>
import { ref, inject } from 'vue' </span>
import { reactive } from 'vue' </template>
import { ElMessage } from 'element-plus' </el-dialog>
import { passwordConfirm, updatePassword } from '@/api/user-boot/user' </template>
import { validatePwd } from '@/utils/common' <script lang="ts" setup>
import { useAdminInfo } from '@/stores/adminInfo' import { ref, inject } from 'vue'
import { reactive } from 'vue'
const adminInfo = useAdminInfo() import { ElMessage } from 'element-plus'
const dialogVisible = ref(false) import { passwordConfirm, updatePassword } from '@/api/user-boot/user'
const title = ref('修改密码') import { validatePwd } from '@/utils/common'
const formRef = ref() import { useAdminInfo } from '@/stores/adminInfo'
// 注意不要和表单ref的命名冲突 import router from '@/router'
const form = reactive({ import { useNavTabs } from '@/stores/navTabs'
password: '', const adminInfo = useAdminInfo()
newPwd: '', const navTabs = useNavTabs()
confirmPwd: '' const dialogVisible = ref(false)
}) const title = ref('修改密码')
const rules = { const formRef = ref()
password: [ // 注意不要和表单ref的命名冲突
{ required: true, message: '请输入校验密码', trigger: 'blur' }, const form = reactive({
{ password: '',
min: 6, newPwd: '',
max: 16, confirmPwd: ''
message: '长度在 6 到 16 个字符', })
trigger: 'blur' const rules = {
} password: [
], { required: true, message: '请输入校验密码', trigger: 'blur' },
newPwd: [ {
{ required: true, message: '请输入密码', trigger: 'blur' }, min: 6,
{ max: 16,
min: 6, message: '长度在 6 到 16 个字符',
max: 16, trigger: 'blur'
message: '长度在 6 到 16 个字符', }
trigger: 'blur' ],
}, newPwd: [
{ validator: validatePwd, trigger: 'blur' } { required: true, message: '请输入密码', trigger: 'blur' },
], {
confirmPwd: [ min: 6,
{ required: true, message: '请确认密码', trigger: 'blur' }, max: 16,
{ message: '长度在 6 到 16 个字符',
min: 6, trigger: 'blur'
max: 16, },
message: '长度在 6 到 16 个字符', { validator: validatePwd, trigger: 'blur' }
trigger: 'blur' ],
}, confirmPwd: [
{ { required: true, message: '请确认密码', trigger: 'blur' },
validator: (rule: any, value: string, callback: any) => { {
if (value === '') { min: 6,
callback(new Error('请再次输入密码')) max: 16,
} else if (value !== form.newPwd) { message: '长度在 6 到 16 个字符',
callback(new Error('两次输入密码不一致!')) trigger: 'blur'
} else { },
callback() {
} validator: (rule: any, value: string, callback: any) => {
}, if (value === '') {
trigger: 'blur', callback(new Error('请再次输入密码'))
required: true } else if (value !== form.newPwd) {
} callback(new Error('两次输入密码不一致!'))
] } else {
} callback()
}
const open = () => { },
dialogVisible.value = true trigger: 'blur',
form.password = '' required: true
form.newPwd = '' }
form.confirmPwd = '' ]
} }
const submit = () => {
formRef.value.validate(async (valid: boolean) => { const open = () => {
if (valid) { dialogVisible.value = true
passwordConfirm(form.password).then(res => { form.password = ''
updatePassword({ form.newPwd = ''
id: adminInfo.$state.userIndex, form.confirmPwd = ''
newPassword: form.newPwd }
}).then((res: any) => { const submit = () => {
ElMessage.success('密码修改成功') formRef.value.validate(async (valid: boolean) => {
dialogVisible.value = false if (valid) {
}) passwordConfirm(form.password).then(res => {
}) updatePassword({
} id: adminInfo.$state.userIndex,
}) newPassword: form.newPwd
} }).then(async (res: any) => {
ElMessage.success('密码修改成功')
defineExpose({ open }) dialogVisible.value = false
</script>
setTimeout(() => {
navTabs.closeTabs()
window.localStorage.clear()
adminInfo.reset()
router.push({ name: 'login' })
}, 0)
})
})
}
})
}
defineExpose({ open })
</script>

View File

@@ -1,47 +1,47 @@
import { createRouter, createWebHashHistory } from 'vue-router' import { createRouter, createWebHashHistory } from 'vue-router'
import staticRoutes from '@/router/static' import staticRoutes from '@/router/static'
import { useAdminInfo } from '@/stores/adminInfo' import { useAdminInfo } from '@/stores/adminInfo'
import NProgress from 'nprogress' import NProgress from 'nprogress'
import { loading } from '@/utils/loading' import { loading } from '@/utils/loading'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
const router = createRouter({ const router = createRouter({
history: createWebHashHistory(), history: createWebHashHistory(),
routes: staticRoutes routes: staticRoutes
}) })
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
NProgress.configure({ showSpinner: false }) NProgress.configure({ showSpinner: false })
NProgress.start() NProgress.start()
if (!window.existLoading) { if (!window.existLoading) {
loading.show() loading.show()
window.existLoading = true window.existLoading = true
} }
if (to.path == '/login' || to.path == '/404'|| to.path == '/policy'|| to.path == '/agreement') { if (to.path == '/login' || to.path == '/404'|| to.path == '/policy'|| to.path == '/agreement') {
// 登录或者注册才可以往下进行 // 登录或者注册才可以往下进行
next() next()
} else { } else {
// 获取 token // 获取 token
const adminInfo = useAdminInfo() const adminInfo = useAdminInfo()
const token = adminInfo.getToken() const token = adminInfo.getToken()
// token 不存在 // token 不存在
if (token === null || token === '') { if (token === null || token === '') {
ElMessage.error('您还没有登录,请先登录') // ElMessage.error('您还没有登录,请先登录')
next('/login') next('/login')
} else { } else {
next() next()
} }
} }
// next() // next()
}) })
// 路由加载后 // 路由加载后
router.afterEach(() => { router.afterEach(() => {
if (window.existLoading) { if (window.existLoading) {
loading.hide() loading.hide()
} }
NProgress.done() NProgress.done()
}) })
export default router export default router

View File

@@ -25,7 +25,6 @@ export const useNavTabs = defineStore(
}) })
function addTab(route: RouteLocationNormalized) { function addTab(route: RouteLocationNormalized) {
console.log('🚀 ~ addTab ~ route:', route)
if (!route.meta.addtab) return if (!route.meta.addtab) return
for (const key in state.tabsView) { for (const key in state.tabsView) {
if (state.tabsView[key].path === route.path) { if (state.tabsView[key].path === route.path) {
@@ -69,7 +68,7 @@ export const useNavTabs = defineStore(
} }
const setTabsViewRoutes = (data: RouteRecordRaw[]): void => { const setTabsViewRoutes = (data: RouteRecordRaw[]): void => {
state.tabsViewRoutes = encodeRoutesURI(data) state.tabsViewRoutes = encodeRoutesURI(JSON.parse(JSON.stringify(data)))
} }
const setAuthNode = (key: string, data: string[]) => { const setAuthNode = (key: string, data: string[]) => {
@@ -87,9 +86,9 @@ export const useNavTabs = defineStore(
const refresh = () => { const refresh = () => {
// setTimeout(() => { // setTimeout(() => {
// console.log(123, state.tabsViewRoutes) // console.log(123, state.tabsViewRoutes)
let list = matchAndReturnRouteData(state.tabsViewRoutes, state.tabsView) let list = matchAndReturnRouteData(state.tabsViewRoutes, state.tabsView)
state.tabsView = [] state.tabsView = []
list.forEach(item => { list.forEach(item => {
addTab(item) addTab(item)
}) })

View File

@@ -1,79 +1,79 @@
<template> <template>
<el-dialog width="600px" v-model.trim='dialogVisible' :title='title'> <el-dialog width="600px" v-model.trim='dialogVisible' :title='title'>
<el-scrollbar> <el-scrollbar>
<el-form :inline='false' :model='form' label-width='auto' class="form-one" :rules='rules' ref='formRef'> <el-form :inline='false' :model='form' label-width='auto' class="form-one" :rules='rules' ref='formRef'>
<el-form-item label='角色名称'> <el-form-item label='角色名称'>
<el-input maxlength="32" show-word-limit v-model.trim='form.name' placeholder='请输入菜单名称' /> <el-input maxlength="32" show-word-limit v-model.trim='form.name' placeholder='请输入菜单名称' />
</el-form-item> </el-form-item>
<el-form-item label='角色编码'> <el-form-item label='角色编码'>
<el-input maxlength="32" show-word-limit v-model.trim='form.code' placeholder='请输入菜单名称' /> <el-input maxlength="32" show-word-limit v-model.trim='form.code' placeholder='请输入菜单名称' />
</el-form-item> </el-form-item>
<el-form-item label='角色描述'> <el-form-item label='角色描述'>
<el-input maxlength="300" show-word-limit v-model.trim='form.remark' :rows='2' type='textarea' <el-input maxlength="300" show-word-limit v-model.trim='form.remark' :rows='2' type='textarea'
placeholder='请输入描述' /> 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 TableStore from '@/utils/tableStore' // 若不是列表页面弹框可删除 import TableStore from '@/utils/tableStore' // 若不是列表页面弹框可删除
const dialogVisible = ref(false) const dialogVisible = ref(false)
const title = ref('') const title = ref('')
const tableStore = inject('tableStore') as TableStore const tableStore = inject('tableStore') as TableStore
const formRef = ref() const formRef = ref()
// 注意不要和表单ref的命名冲突 // 注意不要和表单ref的命名冲突
const form = reactive({ const form = reactive({
code: '', code: '',
name: '', name: '',
remark: '', remark: '',
id: '' id: ''
}) })
const rules = { const rules = {
name: [{ required: true, message: '角色名称不能为空', trigger: 'blur' }], name: [{ required: true, message: '请输入角色名称', trigger: 'blur' }],
code: [{ required: true, message: '角色编码不能为空', trigger: 'blur' }] code: [{ required: true, message: '请输入角色编码', trigger: 'blur' }]
} }
const open = (text: string, data?: anyObj) => { const open = (text: string, data?: anyObj) => {
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 submit = () => { const submit = () => {
formRef.value.validate(async (valid) => { formRef.value.validate(async (valid) => {
if (valid) { if (valid) {
if (form.id) { if (form.id) {
// await update(form) // await update(form)
} else { } else {
// await create(form) // await create(form)
} }
ElMessage.success('保存成功') ElMessage.success('保存成功')
tableStore.index() tableStore.index()
dialogVisible.value = false dialogVisible.value = false
} }
}) })
} }
defineExpose({ open }) defineExpose({ open })
</script> </script>

View File

@@ -44,7 +44,8 @@ const calculateValue = (o: number, value: number, num: number, isMin: boolean) =
} }
if (base === 0.1) { if (base === 0.1) {
return parseFloat(calculatedValue.toFixed(1)) // return parseFloat(calculatedValue.toFixed(1))
return Math.ceil(calculatedValue * 10) / 10
} else if (isMin) { } else if (isMin) {
return Math.floor(calculatedValue / base) * base return Math.floor(calculatedValue / base) * base
} else { } else {

View File

@@ -7,7 +7,7 @@ import { useAdminInfo } from '@/stores/adminInfo'
window.requests = [] window.requests = []
window.tokenRefreshing = false window.tokenRefreshing = false
let loginExpireTimer:any=null let loginExpireTimer: any = null
const pendingMap = new Map() const pendingMap = new Map()
const loadingInstance: LoadingInstance = { const loadingInstance: LoadingInstance = {
target: null, target: null,
@@ -65,14 +65,17 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
if ( if (
!( !(
config.url == '/system-boot/file/upload' || config.url == '/system-boot/file/upload' ||
config.url == '/user-boot/sysRoleSystem/getSystemByRoleId' ||
config.url == '/system-boot/file/getFileUrl' ||
config.url == '/cs-harmonic-boot/realData/getBaseRealData' ||
config.url == '/harmonic-boot/grid/getAssessOverview' || config.url == '/harmonic-boot/grid/getAssessOverview' ||
config.url == '/harmonic-boot/gridDiagram/getGridDiagramAreaData' || config.url == '/harmonic-boot/gridDiagram/getGridDiagramAreaData' ||
config.url == '/cs-device-boot/csline/list' || config.url == '/cs-device-boot/csline/list' ||
config.url == '/cs-harmonic-boot/pqSensitiveUser/getListByIds'|| config.url == '/cs-harmonic-boot/pqSensitiveUser/getListByIds' ||
config.url == '/cs-harmonic-boot/csevent/getEventCoords'|| config.url == '/cs-harmonic-boot/csevent/getEventCoords' ||
config.url == '/cs-harmonic-boot/limitRateDetailD/limitTimeProbabilityData'|| config.url == '/cs-harmonic-boot/limitRateDetailD/limitTimeProbabilityData' ||
config.url == '/cs-harmonic-boot/limitRateDetailD/limitProbabilityData'|| config.url == '/cs-harmonic-boot/limitRateDetailD/limitProbabilityData' ||
config.url == '/system-boot/dictTree/queryByCode'|| config.url == '/system-boot/dictTree/queryByCode' ||
config.url == '/system-boot/dictTree/query' config.url == '/system-boot/dictTree/query'
) )
) )
@@ -111,11 +114,11 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
response => { response => {
removePending(response.config) removePending(response.config)
options.loading && closeLoading(options) // 关闭loading options.loading && closeLoading(options) // 关闭loading
if ( if (
response.data.code === 'A0000' || response.data.code === 'A0000' ||
response.data.type === 'application/json' || response.data.type === 'application/json' ||
Array.isArray(response.data) || Array.isArray(response.data) ||
response.data.size response.data.size
// || // ||
// response.data.type === 'application/octet-stream' || // response.data.type === 'application/octet-stream' ||
// response.data.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' // response.data.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
@@ -150,7 +153,7 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
}) })
} }
} else if (response.data.code == 'A0024') { } else if (response.data.code == 'A0024') {
// // 登录失效 // // 登录失效
// 清除上一次的定时器 // 清除上一次的定时器
if (loginExpireTimer) { if (loginExpireTimer) {
clearTimeout(loginExpireTimer) clearTimeout(loginExpireTimer)
@@ -179,8 +182,7 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
setTimeout(() => { setTimeout(() => {
ElMessage.error(response.data.message || '未知错误') ElMessage.error(response.data.message || '未知错误')
}, 6000) }, 6000)
}else if (response.config.url == '/cs-harmonic-boot/cspage/getByUserId') { } else if (response.config.url == '/cs-harmonic-boot/cspage/getByUserId') {
} else { } else {
ElMessage.error(response.data.message || '未知错误') ElMessage.error(response.data.message || '未知错误')
} }

View File

@@ -304,7 +304,7 @@ export const getMenu = () => {
} }
handlerMenu(res.data) handlerMenu(res.data)
handleAdminRoute(res.data) handleAdminRoute(res.data)
if (route.params.to) { if (route?.params?.to) {
const lastRoute = JSON.parse(route.params.to as string) const lastRoute = JSON.parse(route.params.to as string)
if (lastRoute.path != adminBaseRoutePath) { if (lastRoute.path != adminBaseRoutePath) {
let query = !isEmpty(lastRoute.query) ? lastRoute.query : {} let query = !isEmpty(lastRoute.query) ? lastRoute.query : {}

View File

@@ -45,6 +45,7 @@ export default class TableStore {
pageSize: 20 pageSize: 20
}, },
loading: true, loading: true,
exportLoading: false,
column: [], column: [],
loadCallback: null, loadCallback: null,
resetCallback: null, resetCallback: null,
@@ -196,6 +197,7 @@ export default class TableStore {
[ [
'export', 'export',
() => { () => {
this.table.exportLoading = true
// this.index() // this.index()
let params = { ...this.table.params, pageNum: 1, pageSize: this.table.total } let params = { ...this.table.params, pageNum: 1, pageSize: this.table.total }
createAxios( createAxios(
@@ -206,11 +208,16 @@ export default class TableStore {
}, },
requestPayload(this.method, params, this.paramsPOST) requestPayload(this.method, params, this.paramsPOST)
) )
).then(res => { )
this.table.allData = filtration(res.data.records || res.data) .then(res => {
this.table.exportProcessingData && this.table.exportProcessingData() this.table.allData = filtration(res.data.records || res.data)
this.table.allFlag = data.showAllFlag || true this.table.exportProcessingData && this.table.exportProcessingData()
}) this.table.allFlag = data.showAllFlag || true
this.table.exportLoading = false
})
.catch(() => {
this.table.exportLoading = false
})
} }
] ]
]) ])

View File

@@ -1,136 +1,136 @@
<template> <template>
<div class="default-main"> <div class="default-main">
<div class="custom-table-header"> <div class="custom-table-header">
<div class="title">待审核用户</div> <div class="title">待审核用户</div>
<el-button :icon="Check" type="primary" @click="addRole" class="ml10">审核通过</el-button> <el-button :icon="Check" type="primary" @click="addRole" class="ml10">审核通过</el-button>
</div> </div>
<Table ref="tableRef" /> <Table ref="tableRef" />
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { Check } from '@element-plus/icons-vue' import { Check } from '@element-plus/icons-vue'
import { ref, onMounted, provide } from 'vue' import { ref, onMounted, provide } from 'vue'
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue' import Table from '@/components/table/index.vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { checkUser } from '@/api/user-boot/user' import { checkUser } from '@/api/user-boot/user'
defineOptions({ defineOptions({
name: 'auth/audit' name: 'auth/audit'
}) })
const tableStore = new TableStore({ const tableStore = new TableStore({
showPage: false, showPage: false,
method: 'POST', method: 'POST',
url: '/user-boot/user/checkUserList', url: '/user-boot/user/checkUserList',
column: [ column: [
// { width: '60', type: 'checkbox' }, { width: '60', type: 'checkbox' },
{ title: '名称', field: 'name' }, { title: '名称', field: 'name' },
{ title: '登录名', field: 'loginName' }, { title: '登录名', field: 'loginName' },
{ title: '角色', field: 'roleName' }, { title: '角色', field: 'roleName' },
// { title: '部门', field: 'deptId' }, // { title: '部门', field: 'deptId' },
{ title: '电话', field: 'phoneShow' }, { title: '电话', field: 'phoneShow' },
{ title: '注册时间', field: 'registerTime', sortable: true }, { title: '注册时间', field: 'registerTime', sortable: true },
{ title: '类型', field: 'casualUserName' }, { title: '类型', field: 'casualUserName' },
{ title: '状态', field: 'stateName' }, { title: '状态', field: 'stateName' },
{ {
title: '操作', title: '操作', fixed: 'right',
width: '180', width: '180',
render: 'buttons', render: 'buttons',
buttons: [ buttons: [
{ {
name: 'edit', name: 'edit',
title: '审核通过', title: '审核通过',
type: 'primary', type: 'primary',
icon: 'el-icon-Check', icon: 'el-icon-Check',
render: 'basicButton', render: 'basicButton',
click: row => { click: row => {
checkUser([row.id]).then(res => { checkUser([row.id]).then(res => {
tableStore.index() tableStore.index()
ElMessage.success('操作成功') ElMessage.success('操作成功')
}) })
} }
}, },
{ {
name: 'del', name: 'del',
title: '审核不通过', title: '审核不通过',
type: 'danger', type: 'danger',
icon: 'el-icon-Close', icon: 'el-icon-Close',
render: 'confirmButton', render: 'confirmButton',
popconfirm: { popconfirm: {
confirmButtonText: '确认', confirmButtonText: '确认',
cancelButtonText: '取消', cancelButtonText: '取消',
confirmButtonType: 'danger', confirmButtonType: 'danger',
title: '确定不通过该角色吗?' title: '确定不通过该角色吗?'
}, },
click: row => { click: row => {
ElMessage.warning('功能尚未实现') ElMessage.warning('功能尚未实现')
} }
} }
] ]
} }
], ],
loadCallback: () => { loadCallback: () => {
tableStore.table.data.forEach((item: any) => { tableStore.table.data.forEach((item: any) => {
item.deptId = item.deptId || '/' item.deptId = item.deptId || '/'
item.phoneShow = item.phone || '/' item.phoneShow = item.phone || '/'
item.roleName = item.role.length ? item.role : '/' item.roleName = item.role.length ? item.role : '/'
switch (item.casualUser) { switch (item.casualUser) {
case 0: case 0:
item.casualUserName = '临时用户' item.casualUserName = '临时用户'
break break
case 1: case 1:
item.casualUserName = '长期用户' item.casualUserName = '长期用户'
break break
default: default:
item.casualUserName = '/' item.casualUserName = '/'
break break
} }
switch (item.state) { switch (item.state) {
case 0: case 0:
item.stateName = '注销' item.stateName = '注销'
break break
case 1: case 1:
item.stateName = '正常' item.stateName = '正常'
break break
case 2: case 2:
item.stateName = '锁定' item.stateName = '锁定'
break break
case 3: case 3:
item.stateName = '待审核' item.stateName = '待审核'
break break
case 4: case 4:
item.stateName = '休眠' item.stateName = '休眠'
break break
case 5: case 5:
item.stateName = '密码过期' item.stateName = '密码过期'
break break
default: default:
item.stateName = '/' item.stateName = '/'
break break
} }
}) })
} }
}) })
tableStore.table.params.casualUser = 0 tableStore.table.params.casualUser = 0
tableStore.table.params.searchState = 0 tableStore.table.params.searchState = 0
tableStore.table.params.searchValue = '' tableStore.table.params.searchValue = ''
tableStore.table.params.searchBeginTime = '' tableStore.table.params.searchBeginTime = ''
tableStore.table.params.searchEndTime = '' tableStore.table.params.searchEndTime = ''
tableStore.table.params.sortBy = '' tableStore.table.params.sortBy = ''
tableStore.table.params.orderBy = '' tableStore.table.params.orderBy = ''
provide('tableStore', tableStore) provide('tableStore', tableStore)
onMounted(() => { onMounted(() => {
tableStore.index() tableStore.index()
}) })
const addRole = () => { const addRole = () => {
if (!tableStore.table.selection.length) { if (!tableStore.table.selection.length) {
ElMessage.warning('请选择用户') ElMessage.warning('请选择用户')
return return
} }
checkUser(tableStore.table.selection.map((item: any) => item.id)).then(res => { checkUser(tableStore.table.selection.map((item: any) => item.id)).then(res => {
tableStore.index() tableStore.index()
ElMessage.success('操作成功') ElMessage.success('操作成功')
}) })
} }
</script> </script>

View File

@@ -1,116 +1,136 @@
<template> <template>
<div> <div>
<div class="custom-table-header"> <div class="custom-table-header">
<div class="title">接口权限列表</div> <div class="title">接口权限列表</div>
<el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.searchValue" <el-input
style="width: 240px" placeholder="请输入菜单名称" class="ml10" clearable @input="search" /> maxlength="32"
<el-button :icon="Plus" type="primary" @click="addMenu" class="ml10" :disabled="!props.id">新增</el-button> show-word-limit
</div> v-model.trim="tableStore.table.params.searchValue"
<Table ref="tableRef" /> style="width: 240px"
<popupApi ref="popupRef" @init="tableStore.index()"></popupApi> placeholder="请输入菜单名称"
</div> class="ml10"
</template> clearable
<script setup lang="ts"> @input="search"
import { Plus } from '@element-plus/icons-vue' />
import { ref, Ref, inject, provide, watch } from 'vue' <el-button :icon="Plus" type="primary" @click="addMenu" class="ml10" :disabled="!props.id">新增</el-button>
import TableStore from '@/utils/tableStore' </div>
import Table from '@/components/table/index.vue' <Table ref="tableRef" />
import popupApi from './popupApi.vue' <popupApi ref="popupRef" @init="tableStore.index()"></popupApi>
import { deleteMenu } from '@/api/user-boot/function' </div>
</template>
defineOptions({ <script setup lang="ts">
name: 'auth/menu/api' import { Plus } from '@element-plus/icons-vue'
}) import { ref, Ref, inject, provide, watch } from 'vue'
const emits = defineEmits<{ import TableStore from '@/utils/tableStore'
(e: 'init'): void import Table from '@/components/table/index.vue'
}>() import popupApi from './popupApi.vue'
const props = defineProps({ import { deleteMenu } from '@/api/user-boot/function'
id: { import { ElMessage } from 'element-plus'
type: String, defineOptions({
default: '' name: 'auth/menu/api'
} })
}) const emits = defineEmits<{
const tableRef = ref() (e: 'init'): void
const popupRef = ref() }>()
const apiList = ref([]) const props = defineProps({
const tableStore = new TableStore({ id: {
showPage: false, type: String,
url: '/user-boot/function/getButtonById', default: ''
publicHeight: 60, }
column: [ })
{ title: '普通接口/接口名称', field: 'name' }, const tableRef = ref()
{ const popupRef = ref()
title: '接口类型', const apiList = ref([])
field: 'type', const tableStore = new TableStore({
formatter: row => { showPage: false,
return row.cellValue == 1 ? '普通接口' : '公用接口' url: '/user-boot/function/getButtonById',
} publicHeight: 60,
}, column: [
{ title: 'URL接口路径', field: 'path' }, {
{ field: 'index',
title: '操作', title: '序号',
align: 'center', width: '80',
width: '180', formatter: (row: any) => {
render: 'buttons', return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
buttons: [ }
{ },
name: 'edit', { title: '普通接口/接口名称', field: 'name', minWidth: '180' },
title: '编辑', {
type: 'primary', title: '接口类型',
icon: 'el-icon-EditPen', field: 'type',
render: 'basicButton', minWidth: '140',
click: row => { formatter: row => {
popupRef.value.open('编辑接口权限', row) return row.cellValue == 1 ? '普通接口' : '公用接口'
} }
}, },
{ { title: 'URL接口路径', field: 'path', minWidth: '200' },
name: 'del', {
title: '删除', title: '操作',
type: 'danger', fixed: 'right',
icon: 'el-icon-Delete', align: 'center',
render: 'confirmButton', width: '140',
popconfirm: { render: 'buttons',
confirmButtonText: '确认', buttons: [
cancelButtonText: '取消', {
confirmButtonType: 'danger', name: 'edit',
title: '确定删除该菜单吗?' title: '编辑',
}, type: 'primary',
click: row => { icon: 'el-icon-EditPen',
deleteMenu(row.id).then(() => { render: 'basicButton',
tableStore.index() click: row => {
}) popupRef.value.open('编辑接口权限', row)
} }
} },
] {
} name: 'del',
], title: '删除',
loadCallback: () => { type: 'danger',
apiList.value = tableStore.table.data icon: 'el-icon-Delete',
search() render: 'confirmButton',
} popconfirm: {
}) confirmButtonText: '确认',
tableStore.table.loading = false cancelButtonText: '取消',
watch( confirmButtonType: 'danger',
() => props.id, title: '确定删除该菜单吗?'
() => { },
tableStore.table.params.id = props.id click: row => {
tableStore.index() deleteMenu(row.id).then(() => {
} ElMessage.success('删除成功!')
)
provide('tableStore', tableStore) tableStore.index()
})
const addMenu = () => { }
console.log(popupRef) }
popupRef.value.open('新增接口权限', { ]
pid: props.id }
}) ],
} loadCallback: () => {
const search = () => { apiList.value = tableStore.table.data
tableStore.table.data = apiList.value.filter( search()
(item: any) => }
!tableStore.table.params.searchValue || })
item.name.indexOf(tableStore.table.params.searchValue) !== -1 || tableStore.table.loading = false
item.path.indexOf(tableStore.table.params.searchValue) !== -1 watch(
) () => props.id,
} () => {
</script> tableStore.table.params.id = props.id
tableStore.index()
}
)
provide('tableStore', tableStore)
const addMenu = () => {
console.log(popupRef)
popupRef.value.open('新增接口权限', {
pid: props.id
})
}
const search = () => {
tableStore.table.data = apiList.value.filter(
(item: any) =>
!tableStore.table.params.searchValue ||
item.name.indexOf(tableStore.table.params.searchValue) !== -1 ||
item.path.indexOf(tableStore.table.params.searchValue) !== -1
)
}
</script>

View File

@@ -1,140 +1,142 @@
<template> <template>
<div> <div>
<div class="custom-table-header"> <div class="custom-table-header">
<div class="title">菜单列表</div> <div class="title">菜单列表</div>
<el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.searchValue" <el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.searchValue"
style="width: 310px" placeholder="请输入菜单名称" class="ml10" clearable @input="search" /> style="width: 310px" placeholder="请输入菜单名称" class="ml10" clearable @input="search" />
<el-button :icon="Plus" type="primary" @click="addMenu" class="ml10">新增</el-button> <el-button :icon="Plus" type="primary" @click="addMenu" class="ml10">新增</el-button>
</div> </div>
<Table @currentChange="currentChange" /> <Table @currentChange="currentChange" />
<popupMenu ref="popupRef" @init="emits('init')"></popupMenu> <popupMenu ref="popupRef" @init="emits('init')"></popupMenu>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { Plus } from '@element-plus/icons-vue' import { Plus } from '@element-plus/icons-vue'
import { ref, nextTick, inject, provide, watch } from 'vue' import { ref, nextTick, inject, provide, watch } from 'vue'
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue' import Table from '@/components/table/index.vue'
import popupMenu from './popupMenu.vue' import popupMenu from './popupMenu.vue'
import { delMenu } from '@/api/systerm' import { delMenu } from '@/api/systerm'
import { ElMessage } from 'element-plus'
defineOptions({ defineOptions({
name: 'auth/menu/menu' name: 'auth/menu/menu'
}) })
const emits = defineEmits<{ const emits = defineEmits<{
(e: 'init'): void (e: 'init'): void
(e: 'select', row: any): void (e: 'select', row: any): void
}>() }>()
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
menuData: treeData[] menuData: treeData[]
}>(), }>(),
{ {
menuData: () => { menuData: () => {
return [] return []
} }
} }
) )
const popupRef = ref() const popupRef = ref()
const tableStore = new TableStore({ const tableStore = new TableStore({
showPage: false, showPage: false,
url: '/user-boot/function/functionTree', url: '/user-boot/function/functionTree',
publicHeight: 60, publicHeight: 60,
column: [ column: [
{ title: '菜单名称', field: 'title', align: 'left', treeNode: true }, { title: '菜单名称', field: 'title', align: 'left', treeNode: true },
{ {
title: '图标', title: '图标',
field: 'icon', field: 'icon',
align: 'center', align: 'center',
width: '60', width: '60',
render: 'icon' render: 'icon'
}, },
{ {
title: '操作', title: '操作', fixed: 'right',
align: 'center', align: 'center',
width: '180', width: '180',
render: 'buttons', render: 'buttons',
buttons: [ buttons: [
{ {
name: 'edit', name: 'edit',
text: '新增', text: '新增',
type: 'primary', type: 'primary',
icon: 'el-icon-Plus', icon: 'el-icon-Plus',
render: 'basicButton', render: 'basicButton',
click: row => { click: row => {
popupRef.value.open('新增菜单', { pid: row.id }) popupRef.value.open('新增菜单', { pid: row.id })
} }
}, },
{ {
name: 'edit', name: 'edit',
text: '编辑', text: '编辑',
type: 'primary', type: 'primary',
icon: 'el-icon-EditPen', icon: 'el-icon-EditPen',
render: 'basicButton', render: 'basicButton',
click: row => { click: row => {
popupRef.value.open('编辑菜单', row) popupRef.value.open('编辑菜单', row)
} }
}, },
{ {
name: 'del', name: 'del',
text: '删除', text: '删除',
type: 'danger', type: 'danger',
icon: 'el-icon-Delete', icon: 'el-icon-Delete',
render: 'confirmButton', render: 'confirmButton',
popconfirm: { popconfirm: {
confirmButtonText: '确认', confirmButtonText: '确认',
cancelButtonText: '取消', cancelButtonText: '取消',
confirmButtonType: 'danger', confirmButtonType: 'danger',
title: '确定删除该菜单吗?' title: '确定删除该菜单吗?'
}, },
click: row => { click: row => {
delMenu(row.id).then(() => { delMenu(row.id).then(() => {
emits('init') ElMessage.success('删除成功!')
})
} emits('init')
} })
] }
} }
] ]
}) }
tableStore.table.loading = false ]
watch( })
() => props.menuData, tableStore.table.loading = false
() => { watch(
search() () => props.menuData,
} () => {
) search()
provide('tableStore', tableStore) }
)
const addMenu = () => { provide('tableStore', tableStore)
popupRef.value.open('新增菜单', {})
} const addMenu = () => {
const currentChange = (newValue: any) => { popupRef.value.open('新增菜单', {})
emits('select', newValue.row.id) }
} const currentChange = (newValue: any) => {
const search = () => { emits('select', newValue.row.id)
tableStore.table.data = filterData(JSON.parse(JSON.stringify(props.menuData))) }
if (tableStore.table.params.searchValue) { const search = () => {
nextTick(() => { tableStore.table.data = filterData(JSON.parse(JSON.stringify(props.menuData)))
tableStore.table.ref?.setAllTreeExpand(true) if (tableStore.table.params.searchValue) {
}) nextTick(() => {
} tableStore.table.ref?.setAllTreeExpand(true)
} })
}
// 过滤 }
const filterData = (arr: treeData[]): treeData[] => {
if (!tableStore.table.params.searchValue) { // 过滤
return arr const filterData = (arr: treeData[]): treeData[] => {
} if (!tableStore.table.params.searchValue) {
return arr.filter((item: treeData) => { return arr
if (item.title.includes(tableStore.table.params.searchValue)) { }
return true return arr.filter((item: treeData) => {
} else if (item.children?.length > 0) { if (item.title.includes(tableStore.table.params.searchValue)) {
item.children = filterData(item.children) return true
return item.children.length > 0 } else if (item.children?.length > 0) {
} else { item.children = filterData(item.children)
return false return item.children.length > 0
} } else {
}) return false
} }
</script> })
}
</script>

View File

@@ -1,104 +1,134 @@
<template> <template>
<el-dialog width="700px" v-model.trim="dialogVisible" :title="title"> <el-dialog width="700px" v-model.trim="dialogVisible" :title="title">
<el-scrollbar> <el-scrollbar>
<el-form :mode="form" :inline="false" :model="form" label-width="120px" :rules="rules" class="form-one"> <el-form
<el-form-item prop="name" label="接口/按钮名称"> :mode="form"
<el-input maxlength="32" show-word-limit v-model.trim="form.name" placeholder="请输入接口名称" /> :inline="false"
</el-form-item> ref="formRef"
<el-form-item prop="code" label="接口/按钮标识"> :model="form"
<el-input maxlength="32" show-word-limit v-model.trim="form.code" placeholder="请输入英文接口标识" /> label-width="120px"
</el-form-item> :rules="rules"
<el-form-item prop="path" label="接口路径"> class="form-one"
<el-input v-model.trim="form.path" placeholder="请输入接口路径" /> >
</el-form-item> <el-form-item prop="name" label="接口/按钮名称">
<el-form-item prop="type" label="接口类型"> <el-input maxlength="32" show-word-limit v-model.trim="form.name" placeholder="请输入接口名称" />
<el-radio-group v-model.trim="form.type"> </el-form-item>
<el-radio :label="1">普通接口</el-radio> <el-form-item prop="code" label="接口/按钮标识">
<el-radio :label="2">公用接口</el-radio> <el-input
</el-radio-group> maxlength="32"
</el-form-item> show-word-limit
<el-form-item prop="sort" label="排序"> v-model.trim="form.code"
<el-input maxlength="32" show-word-limit-number v-model.trim="form.sort" :min="0" /> placeholder="请输入英文接口标识"
</el-form-item> />
<el-form-item prop="remark" label="接口/按钮描述"> </el-form-item>
<el-input maxlength="300" show-word-limit v-model.trim="form.remark" :rows="2" type="textarea" <el-form-item prop="path" label="接口路径">
placeholder="请输入描述" /> <el-input v-model.trim="form.path" placeholder="请输入接口路径" />
</el-form-item> </el-form-item>
</el-form> <el-form-item prop="type" label="接口类型">
</el-scrollbar> <el-radio-group v-model.trim="form.type">
<el-radio :label="1">普通接口</el-radio>
<template #footer> <el-radio :label="2">公用接口</el-radio>
<span class="dialog-footer"> </el-radio-group>
<el-button @click="dialogVisible = false">取消</el-button> </el-form-item>
<el-button type="primary" @click="submit">确认</el-button> <el-form-item prop="sort" label="排序">
</span> <el-input maxlength="32" show-word-limit-number v-model.number="form.sort" :min="0" />
</template> </el-form-item>
</el-dialog> <el-form-item prop="remark" label="接口/按钮描述">
</template> <el-input
<script lang="ts" setup> maxlength="300"
import { ref, inject } from 'vue' show-word-limit
import { reactive } from 'vue' v-model.trim="form.remark"
import { update, add } from '@/api/user-boot/function' :rows="2"
type="textarea"
defineOptions({ placeholder="请输入描述"
name: 'auth/menu/popupApi' />
}) </el-form-item>
const emits = defineEmits<{ </el-form>
(e: 'init'): void </el-scrollbar>
}>()
const form: any = reactive({ <template #footer>
id: '', <span class="dialog-footer">
pid: '0', <el-button @click="dialogVisible = false">取消</el-button>
code: '', <el-button type="primary" @click="submit">确认</el-button>
name: '', </span>
path: '', </template>
type: 1, </el-dialog>
sort: 100, </template>
remark: '' <script lang="ts" setup>
}) import { ref, inject } from 'vue'
const rules = { import { reactive } from 'vue'
code: [ import { update, add } from '@/api/user-boot/function'
{ required: true, message: '标识不能为空', trigger: 'blur' }, import { ElMessage } from 'element-plus'
{ defineOptions({
pattern: /^[a-zA-Z_]{1}[a-zA-Z0-9_]{2,20}$/, name: 'auth/menu/popupApi'
message: '请输入至少3-20位英文', })
min: 3, const emits = defineEmits<{
max: 20, (e: 'init'): void
trigger: 'blur' }>()
} const formRef = ref()
], const form: any = reactive({
name: [{ required: true, message: '请输入接口名称', trigger: 'blur' }], id: '',
sort: [{ required: true, message: '请输入排序', trigger: 'blur' }], pid: '0',
path: [{ required: true, message: '请输入接口路径', trigger: 'blur' }] code: '',
} name: '',
const dialogVisible = ref(false) path: '',
const title = ref('新增菜单') type: 1,
const open = (text: string, data: anyObj) => { sort: 100,
title.value = text remark: ''
// 重置表单 })
for (let key in form) { const rules = {
form[key] = '' code: [
} { required: true, message: '请输入标识', trigger: 'blur' },
form.type = 1 {
form.pid = data.pid pattern: /^[a-zA-Z_]{1}[a-zA-Z0-9_]{2,20}$/,
if (data.id) { message: '请输入至少3-20位英文',
for (let key in form) { min: 3,
form[key] = data[key] || '' max: 20,
} trigger: 'blur'
} }
dialogVisible.value = true ],
} name: [{ required: true, message: '请输入接口名称', trigger: 'blur' }],
const submit = async () => { sort: [{ required: true, message: '请输入排序', trigger: 'blur' }],
if (form.id) { path: [{ required: true, message: '请输入接口路径', trigger: 'blur' }]
await update(form) }
} else { const dialogVisible = ref(false)
let obj = JSON.parse(JSON.stringify(form)) const title = ref('新增菜单')
delete obj.id const open = (text: string, data: anyObj) => {
await add(obj) formRef.value?.resetFields()
} title.value = text
emits('init') // 重置表单
dialogVisible.value = false for (let key in form) {
} form[key] = ''
}
defineExpose({ open }) form.type = 1
</script> form.sort = 100
form.pid = data.pid
if (data.id) {
for (let key in form) {
form[key] = data[key] || ''
}
}
dialogVisible.value = true
}
const submit = async () => {
formRef.value.validate(async valid => {
if (valid) {
if (form.id) {
await update(form).then(() => {
ElMessage.success('修改成功!')
})
} else {
let obj = JSON.parse(JSON.stringify(form))
delete obj.id
await add(obj).then(() => {
ElMessage.success('新增成功!')
})
}
emits('init')
dialogVisible.value = false
}
})
}
defineExpose({ open })
</script>

View File

@@ -1,29 +1,43 @@
<template> <template>
<el-dialog class="cn-operate-dialog" width="700px" v-model.trim="dialogVisible" :title="title"> <el-dialog class="cn-operate-dialog" width="700px" v-model.trim="dialogVisible" :title="title">
<el-scrollbar> <el-scrollbar>
<el-form :inline="false" :model="form" label-width="auto" class="form-one"> <el-form :inline="false" :model="form" label-width="auto" ref="formRef" class="form-one" :rules="rules">
<el-form-item label="上级菜单"> <el-form-item label="上级菜单">
<el-cascader v-model.trim="form.pid" :options="tableStore.table.data" :props="cascaderProps" clearable <el-cascader
style="width: 100%" /> v-model.trim="form.pid"
:options="tableStore.table.data"
:props="cascaderProps"
clearable
style="width: 100%"
/>
</el-form-item> </el-form-item>
<el-form-item label="菜单名称"> <el-form-item label="菜单名称" prop="name">
<el-input maxlength="32" show-word-limit v-model.trim="form.name" placeholder="请输入菜单名称" /> <el-input maxlength="32" show-word-limit v-model.trim="form.name" placeholder="请输入菜单名称" />
</el-form-item> </el-form-item>
<el-form-item label="图标"> <el-form-item label="图标">
<IconSelector v-model.trim="form.icon" placeholder="请选择图标" /> <IconSelector v-model.trim="form.icon" placeholder="请选择图标" />
</el-form-item> </el-form-item>
<el-form-item label="菜单路由"> <el-form-item label="菜单路由" prop="path">
<el-input v-model.trim="form.path" placeholder="请输入菜单名称" /> <el-input v-model.trim="form.path" placeholder="请输入菜单名称" />
</el-form-item> </el-form-item>
<el-form-item label="组件路径"> <el-form-item label="组件路径" prop="routeName">
<el-input v-model.trim="form.routeName" placeholder="请输入组件路径,如/src/views/dashboard/index.vue" /> <el-input
v-model.trim="form.routeName"
placeholder="请输入组件路径,如/src/views/dashboard/index.vue"
/>
</el-form-item> </el-form-item>
<el-form-item label="排序"> <el-form-item label="排序" prop="sort">
<el-input maxlength="32" show-word-limit-number v-model.trim="form.sort" :min="0" /> <el-input maxlength="32" show-word-limit-number v-model.number="form.sort" :min="0" />
</el-form-item> </el-form-item>
<el-form-item label="菜单描述"> <el-form-item label="菜单描述">
<el-input maxlength="300" show-word-limit v-model.trim="form.remark" :rows="2" type="textarea" <el-input
placeholder="请输入描述" /> maxlength="300"
show-word-limit
v-model.trim="form.remark"
:rows="2"
type="textarea"
placeholder="请输入描述"
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-scrollbar> </el-scrollbar>
@@ -42,10 +56,11 @@ import { reactive } from 'vue'
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import IconSelector from '@/components/baInput/components/iconSelector.vue' import IconSelector from '@/components/baInput/components/iconSelector.vue'
import { updateMenu, addMenu } from '@/api/systerm' import { updateMenu, addMenu } from '@/api/systerm'
import { ElMessage } from 'element-plus'
defineOptions({ defineOptions({
name: 'auth/menu/popupMenu' name: 'auth/menu/popupMenu'
}) })
const formRef = ref()
const emits = defineEmits<{ const emits = defineEmits<{
(e: 'init'): void (e: 'init'): void
}>() }>()
@@ -71,7 +86,15 @@ const form: any = reactive({
const dialogVisible = ref(false) const dialogVisible = ref(false)
const title = ref('新增菜单') const title = ref('新增菜单')
const rules = {
name: [{ required: true, message: '请输入菜单名称', trigger: 'blur' }],
path: [{ required: true, message: '请输入菜单路由', trigger: 'blur' }],
icon: [{ required: true, message: '请选择图标', trigger: 'blur' }],
routeName: [{ required: true, message: '请输入组件路径', trigger: 'blur' }],
sort: [{ required: true, message: '请输入排序', trigger: 'blur' }]
}
const open = (text: string, data: anyObj) => { const open = (text: string, data: anyObj) => {
formRef.value?.resetFields()
title.value = text title.value = text
// 重置表单 // 重置表单
for (let key in form) { for (let key in form) {
@@ -91,17 +114,27 @@ const open = (text: string, data: anyObj) => {
dialogVisible.value = true dialogVisible.value = true
} }
const submit = async () => { const submit = async () => {
if (form.id) { formRef.value.validate(async valid => {
form.pid = form.pid||'0' if (valid) {
await updateMenu(form) if (form.id) {
} else { form.pid = form.pid || '0'
form.code = 'menu' await updateMenu(form).then(() => {
let obj = JSON.parse(JSON.stringify(form)) ElMessage.success('编辑成功!')
delete obj.id })
await addMenu(obj) } else {
} form.code = 'menu'
emits('init') form.pid = form.pid || '0'
dialogVisible.value = false let obj = JSON.parse(JSON.stringify(form))
delete obj.id
await addMenu(obj).then(() => {
ElMessage.success('新增成功!')
})
}
emits('init')
dialogVisible.value = false
}
})
} }
defineExpose({ open }) defineExpose({ open })

View File

@@ -7,16 +7,34 @@
</div> </div>
<Table ref="tableRef" :row-config="{ isCurrent: true, isHover: true }" @currentChange="currentChange" /> <Table ref="tableRef" :row-config="{ isCurrent: true, isHover: true }" @currentChange="currentChange" />
</div> </div>
<Tree <div>
v-if="menuListId" <el-tabs type="border-card">
ref="treeRef" <el-tab-pane label="菜单">
show-checkbox <Tree
width="350px" v-if="menuListId"
:data="menuTree" ref="treeRef"
:checkStrictly="false" show-checkbox
@checkChange="checkChange" width="350px"
></Tree> :data="menuTree"
<el-empty style="width: 350px; padding-top: 300px; box-sizing: border-box" description="请选择角色" v-else /> :checkStrictly="checkStrictly"
@checkChange="checkChange"
></Tree>
<el-empty
style="width: 350px; padding-top: 300px; box-sizing: border-box"
description="请选择角色"
v-else
/>
</el-tab-pane>
<el-tab-pane label="系统">
<div class="mt10 mr10" style="display: flex; justify-content: end">
<el-button type="primary" icon="el-icon-Select" @click="saveSystem">保存</el-button>
</div>
<el-checkbox-group v-model="systemIds" class="md10 system">
<el-checkbox v-for="item in systemList" :label="item.name" :value="item.id" :key="item.id" />
</el-checkbox-group>
</el-tab-pane>
</el-tabs>
</div>
<PopupForm ref="popupRef"></PopupForm> <PopupForm ref="popupRef"></PopupForm>
</div> </div>
</template> </template>
@@ -28,17 +46,20 @@ import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue' import TableHeader from '@/components/table/header/index.vue'
import Tree from '@/components/tree/allocation.vue' import Tree from '@/components/tree/allocation.vue'
import { functionTree } from '@/api/user-boot/function' import { functionTree } from '@/api/user-boot/function'
import { getFunctionsByRoleIndex, updateRoleMenu } from '@/api/user-boot/roleFuction' import { getFunctionsByRoleIndex, updateRoleMenu, getSystemByRoleId, systemAdd } from '@/api/user-boot/roleFuction'
import { mainHeight } from '@/utils/layout' import { mainHeight } from '@/utils/layout'
import { del } from '@/api/user-boot/role' import { del } from '@/api/user-boot/role'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import PopupForm from './popupForm.vue' import PopupForm from './popupForm.vue'
import { useAdminInfo } from '@/stores/adminInfo' import { useAdminInfo } from '@/stores/adminInfo'
import { useDictData } from '@/stores/dictData'
const dictData = useDictData()
const systemList = dictData.getBasicData('System_Type')
const adminInfo = useAdminInfo() const adminInfo = useAdminInfo()
defineOptions({ defineOptions({
name: 'auth/role' name: 'auth/role'
}) })
const systemIds = ref([])
const height = mainHeight(20).height const height = mainHeight(20).height
const treeRef = ref() const treeRef = ref()
const menuTree = ref<treeData[]>([]) const menuTree = ref<treeData[]>([])
@@ -69,7 +90,7 @@ const tableStore = new TableStore({
} }
}, },
{ {
title: '操作', title: '操作', fixed: 'right',
align: 'center', align: 'center',
width: '180', width: '180',
render: 'buttons', render: 'buttons',
@@ -141,15 +162,21 @@ const currentChange = (data: any) => {
menuListId.value = data.row.id menuListId.value = data.row.id
getFunctionsByRoleIndex({ id: data.row.id }).then((res: any) => { getFunctionsByRoleIndex({ id: data.row.id }).then((res: any) => {
treeRef.value.treeRef.setCheckedKeys(res.data.map((item: any) => item.id)) treeRef.value.treeRef.setCheckedKeys(res.data.map((item: any) => item.id))
setTimeout(() => {
checkStrictly.value = false
}, 100)
})
getSystemByRoleId({ id: data.row.id }).then((res: any) => {
systemIds.value = res.data.systemIds || []
}) })
} }
const timeout = ref<NodeJS.Timeout>() const timeout = ref<NodeJS.Timeout>()
const checkChange = (data: any) => { const checkChange = (data: any) => {
// if (checkStrictly.value) { if (checkStrictly.value) {
// checkStrictly.value = false checkStrictly.value = false
// return return
// } }
updateRoleMenu({ updateRoleMenu({
id: menuListId.value, id: menuListId.value,
@@ -163,6 +190,19 @@ const checkChange = (data: any) => {
treeRef.value.loading = false treeRef.value.loading = false
}) })
} }
const saveSystem = () => {
systemAdd({
roleId: menuListId.value,
systemIds: systemIds.value
})
.then(() => {
ElMessage.success('操作成功!')
treeRef.value.loading = false
})
.catch(() => {
treeRef.value.loading = false
})
}
onMounted(() => { onMounted(() => {
tableStore.index() tableStore.index()
}) })
@@ -170,3 +210,17 @@ const addRole = () => {
popupRef.value.open('新增角色') popupRef.value.open('新增角色')
} }
</script> </script>
<style lang="scss" scoped>
:deep(.el-tabs--border-card > .el-tabs__content) {
padding: 0px !important;
}
.system {
width: 330px;
height: calc(100vh - 225px);
border: 1px solid var(--el-border-color);
padding: 5px 10px;
display: flex;
flex-direction: column;
}
</style>

View File

@@ -1,74 +1,86 @@
<template> <template>
<el-dialog class="cn-operate-dialog" width="700px" v-model.trim="dialogVisible" :title="title"> <el-dialog class="cn-operate-dialog" width="500px" v-model.trim="dialogVisible" :title="title">
<el-form :inline="false" :model="form" label-width="auto" class="form-one" :rules="rules"> <el-form :inline="false" ref="formRef" :model="form" label-width="auto" class="form-one" :rules="rules">
<el-form-item label="角色名称"> <el-form-item label="角色名称" prop="name">
<el-input maxlength="32" show-word-limit v-model.trim="form.name" placeholder="请输入菜单名称" /> <el-input maxlength="32" show-word-limit v-model.trim="form.name" placeholder="请输入菜单名称" />
</el-form-item> </el-form-item>
<el-form-item label="角色编码"> <el-form-item label="角色编码" prop="code">
<el-input maxlength="32" show-word-limit v-model.trim="form.code" placeholder="请输入菜单名称" /> <el-input maxlength="32" show-word-limit v-model.trim="form.code" placeholder="请输入菜单名称" />
</el-form-item> </el-form-item>
<el-form-item label="角色描述"> <el-form-item label="角色描述">
<el-input maxlength="300" show-word-limit v-model.trim="form.remark" :rows="2" type="textarea" <el-input
placeholder="请输入描述" /> maxlength="300"
</el-form-item> show-word-limit
</el-form> v-model.trim="form.remark"
:rows="2"
<template #footer> type="textarea"
<span class="dialog-footer"> placeholder="请输入描述"
<el-button @click="dialogVisible = false">取消</el-button> />
<el-button type="primary" @click="submit">确认</el-button> </el-form-item>
</span> </el-form>
</template>
</el-dialog> <template #footer>
</template> <span class="dialog-footer">
<script lang="ts" setup> <el-button @click="dialogVisible = false">取消</el-button>
import { ref, inject } from 'vue' <el-button type="primary" @click="submit">确认</el-button>
import { reactive } from 'vue' </span>
import TableStore from '@/utils/tableStore' </template>
import { ElMessage } from 'element-plus' </el-dialog>
import { add, update } from '@/api/user-boot/role' </template>
import { useAdminInfo } from '@/stores/adminInfo' <script lang="ts" setup>
import { ref, inject } from 'vue'
const adminInfo = useAdminInfo() import { reactive } from 'vue'
const tableStore = inject('tableStore') as TableStore import TableStore from '@/utils/tableStore'
// do not use same name with ref import { ElMessage } from 'element-plus'
const form = reactive({ import { add, update } from '@/api/user-boot/role'
code: '', import { useAdminInfo } from '@/stores/adminInfo'
name: '',
remark: '', const adminInfo = useAdminInfo()
id: '', const tableStore = inject('tableStore') as TableStore
type: 0 // do not use same name with ref
}) const form = reactive({
const rules = { code: '',
name: [{ required: true, message: '角色名称不能为空', trigger: 'blur' }], name: '',
code: [{ required: true, message: '角色编码不能为空', trigger: 'blur' }] remark: '',
} id: '',
const dialogVisible = ref(false) type: 0
const title = ref('新增菜单') })
const open = (text: string, data?: anyObj) => { const rules = {
title.value = text name: [{ required: true, message: '请输入角色名称', trigger: 'blur' }],
dialogVisible.value = true code: [{ required: true, message: '请输入角色编码', trigger: 'blur' }]
if (data) { }
for (let key in form) { const dialogVisible = ref(false)
form[key] = data[key] const title = ref('新增菜单')
} const formRef = ref()
} else { const open = (text: string, data?: anyObj) => {
for (let key in form) { formRef.value?.resetFields()
form[key] = '' title.value = text
} dialogVisible.value = true
} if (data) {
} for (let key in form) {
const submit = async () => { form[key] = data[key]
if (form.id) { }
await update(form) } else {
} else { for (let key in form) {
form.type = adminInfo.$state.userType + 1 form[key] = ''
await add(form) }
} }
ElMessage.success('保存成功') }
tableStore.index() const submit = async () => {
dialogVisible.value = false formRef.value.validate(async valid => {
} if (valid) {
if (form.id) {
defineExpose({ open }) await update(form)
</script> } else {
form.type = adminInfo.$state.userType + 1
await add(form)
}
ElMessage.success('保存成功')
tableStore.index()
dialogVisible.value = false
}
})
}
defineExpose({ open })
</script>

View File

@@ -79,10 +79,10 @@ const tableStore = new TableStore({
} }
}, },
{ {
title: '操作', title: '操作', fixed: 'right',
width: '180', width: '180',
render: 'buttons', render: 'buttons',
fixed: 'right',
buttons: [ buttons: [
{ {
name: 'edit', name: 'edit',
@@ -95,6 +95,7 @@ const tableStore = new TableStore({
}, },
click: row => { click: row => {
popupEditRef.value.open('编辑用户', row) popupEditRef.value.open('编辑用户', row)
console.log("🚀 ~ row:", row)
} }
}, },
{ {

View File

@@ -1,245 +1,277 @@
<template> <template>
<el-dialog class="cn-operate-dialog" v-model.trim="dialogVisible" :title="title"> <el-dialog class="cn-operate-dialog" v-model.trim="dialogVisible" :title="title">
<el-form :model="form" ref="formRef" label-width="auto" class="form-two" :rules="rules">
<el-form :model="form" label-width="auto" class="form-two" :rules="rules"> <el-form-item label="用户名" prop="name">
<el-form-item label="用户名" prop="name"> <el-input maxlength="32" show-word-limit v-model.trim="form.name" placeholder="请输入昵称" />
<el-input maxlength="32" show-word-limit v-model.trim="form.name" placeholder="请输入昵称" /> </el-form-item>
</el-form-item> <el-form-item label="登录名" prop="loginName">
<el-form-item label="登录名" prop="loginName"> <el-input maxlength="32" show-word-limit v-model.trim="form.loginName" placeholder="请输入登录名" />
<el-input maxlength="32" show-word-limit v-model.trim="form.loginName" placeholder="请输入登录名" /> </el-form-item>
</el-form-item> <el-form-item label="默认密码" prop="password" v-if="title === '新增用户'">
<el-form-item label="默认密码" prop="password" v-if="title === '新增用户'"> <el-input
<el-input maxlength="32" show-word-limit v-model.trim="form.password" placeholder="请输入密码" disabled /> maxlength="32"
</el-form-item> show-word-limit
<el-form-item label="权限类型" prop="type"> v-model.trim="form.password"
<el-select v-model.trim="form.type" @change="changeValue" disabled placeholder="请选择权限类型"> placeholder="请输入密码"
<el-option v-for="(item, index) in UserTypeOption" :label="item.label" :value="item.value" disabled
:key="index"></el-option> />
</el-select> </el-form-item>
</el-form-item> <el-form-item label="权限类型" prop="type">
<el-form-item label="用户类型" prop="casualUser"> <el-select v-model.trim="form.type" @change="changeValue" disabled placeholder="请选择权限类型">
<el-select v-model.trim="form.casualUser" placeholder="请选择权限类型"> <el-option
<el-option v-for="(item, index) in TypeOptions" :label="item.label" :value="item.value" v-for="(item, index) in UserTypeOption"
:key="index"></el-option> :label="item.label"
</el-select> :value="item.value"
</el-form-item> :key="index"
<!-- <el-form-item label="所属部门" prop="deptId"> ></el-option>
<Area v-model.trim="form.deptId" /> </el-select>
</el-form-item> --> </el-form-item>
<el-form-item label="角色" prop="role"> <el-form-item label="用户类型" prop="casualUser">
<el-select v-model.trim="form.role" placeholder="请选择角色" multiple collapse-tags> <el-select v-model.trim="form.casualUser" placeholder="请选择权限类型">
<el-option v-for="(item, index) in roleOptions" :label="item.label" :value="item.value" <el-option
:key="index"></el-option> v-for="(item, index) in TypeOptions"
</el-select> :label="item.label"
</el-form-item> :value="item.value"
:key="index"
<el-form-item label="手机号" prop="phone"> ></el-option>
<el-input maxlength="32" show-word-limit v-model.trim="form.phone" placeholder="请输入手机号" /> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="邮箱" prop="email"> <!-- <el-form-item label="所属部门" prop="deptId">
<el-input maxlength="32" show-word-limit v-model.trim="form.email" placeholder="请输入描述" /> <Area v-model.trim="form.deptId" />
</el-form-item> </el-form-item> -->
<el-form-item label="时间段" prop="limitTime"> <el-form-item label="角色" prop="role">
<el-slider v-model.trim="form.limitTime" style="width: 95%" range show-stops :max="24" /> <el-select v-model.trim="form.role" placeholder="请选择角色" multiple collapse-tags>
</el-form-item> <el-option
<el-form-item label="起始IP" prop="limitIpStart"> v-for="(item, index) in roleOptions"
<el-input maxlength="32" show-word-limit v-model.trim="form.limitIpStart" placeholder="请输入描述" /> :label="item.label"
</el-form-item> :value="item.value"
<el-form-item label="结束IP" prop="limitIpEnd"> :key="index"
<el-input maxlength="32" show-word-limit v-model.trim="form.limitIpEnd" placeholder="请输入描述" /> ></el-option>
</el-form-item> </el-select>
</el-form-item>
<el-form-item label="短信通知" prop="smsNotice">
<el-radio-group v-model.trim="form.smsNotice" style="width: 200px"> <el-form-item label="手机号" prop="phone">
<el-radio-button :label="0"></el-radio-button> <el-input maxlength="32" show-word-limit v-model.trim="form.phone" placeholder="请输入手机号" />
<el-radio-button :label="1"></el-radio-button> </el-form-item>
</el-radio-group> <el-form-item label="邮箱" prop="email">
</el-form-item> <el-input maxlength="32" show-word-limit v-model.trim="form.email" placeholder="请输入描述" />
<el-form-item label="邮件通知" prop="emailNotice"> </el-form-item>
<el-radio-group v-model.trim="form.emailNotice" style="width: 200px"> <el-form-item label="时间段" prop="limitTime">
<el-radio-button :label="0"></el-radio-button> <el-slider v-model.trim="form.limitTime" style="width: 95%" range show-stops :max="24" />
<el-radio-button :label="1"></el-radio-button> </el-form-item>
</el-radio-group> <el-form-item label="起始IP" prop="limitIpStart">
</el-form-item> <el-input maxlength="32" show-word-limit v-model.trim="form.limitIpStart" placeholder="请输入描述" />
<el-form-item label="用户ID"> </el-form-item>
<div style="display: flex; width: 100%"> <el-form-item label="结束IP" prop="limitIpEnd">
<el-radio-group v-model.trim="useId"> <el-input maxlength="32" show-word-limit v-model.trim="form.limitIpEnd" placeholder="请输入描述" />
<el-radio-button :label="1"></el-radio-button> </el-form-item>
<el-radio-button :label="0"></el-radio-button>
</el-radio-group> <el-form-item label="短信通知" prop="smsNotice">
<el-input maxlength="32" show-word-limit :disabled="title !== '新增用户'" v-model.trim="form.id" <el-radio-group v-model.trim="form.smsNotice" style="width: 200px">
placeholder="请输入用户id" v-if="useId" style="flex: 1;" class="ml10"></el-input> <el-radio-button :label="0"></el-radio-button>
</div> <el-radio-button :label="1"></el-radio-button>
</el-form-item> </el-radio-group>
</el-form> </el-form-item>
<el-form-item label="邮件通知" prop="emailNotice">
<template #footer> <el-radio-group v-model.trim="form.emailNotice" style="width: 200px">
<span class="dialog-footer"> <el-radio-button :label="0"></el-radio-button>
<el-button @click="dialogVisible = false">取消</el-button> <el-radio-button :label="1"></el-radio-button>
<el-button type="primary" @click="submit">确认</el-button> </el-radio-group>
</span> </el-form-item>
</template> <el-form-item label="用户ID">
</el-dialog> <div style="display: flex; width: 100%">
</template> <el-radio-group v-model.trim="useId">
<script lang="ts" setup> <el-radio-button :label="1"></el-radio-button>
import { ref, inject } from 'vue' <el-radio-button :label="0"></el-radio-button>
import { reactive } from 'vue' </el-radio-group>
import TableStore from '@/utils/tableStore' <el-input
import { ElMessage, FormItemRule } from 'element-plus' maxlength="32"
import { roleList } from '@/api/user-boot/role' show-word-limit
import { add, edit } from '@/api/user-boot/user' :disabled="title !== '新增用户'"
import { useAdminInfo } from '@/stores/adminInfo' v-model.trim="form.id"
import Area from '@/components/form/area/index.vue' placeholder="请输入用户id"
import { Arrayable } from 'element-plus/es/utils' v-if="useId"
style="flex: 1"
const adminInfo = useAdminInfo() class="ml10"
const tableStore = inject('tableStore') as TableStore ></el-input>
// do not use same name with ref </div>
const form = reactive({ </el-form-item>
id: '', </el-form>
name: '',
password: '123456', <template #footer>
email: '', <span class="dialog-footer">
limitIpStart: '', <el-button @click="dialogVisible = false">取消</el-button>
deptId: '', <el-button type="primary" @click="submit">确认</el-button>
deptName: '', </span>
casualUser: 1, </template>
loginName: '', </el-dialog>
phone: '', </template>
limitIpEnd: '', <script lang="ts" setup>
limitTime: [1, 2], import { ref, inject } from 'vue'
role: [], import { reactive } from 'vue'
smsNotice: 0, import TableStore from '@/utils/tableStore'
emailNotice: 0, import { ElMessage, FormItemRule } from 'element-plus'
type: 0 import { roleList } from '@/api/user-boot/role'
}) import { add, edit } from '@/api/user-boot/user'
const rules: Partial<Record<string, Arrayable<FormItemRule>>> = { import { useAdminInfo } from '@/stores/adminInfo'
name: [{ required: true, message: '用户名不能为空', trigger: 'blur' }], import Area from '@/components/form/area/index.vue'
role: [{ required: true, message: '角色不能为空', trigger: 'blur' }], import { Arrayable } from 'element-plus/es/utils'
password: [{ required: true, message: '用户密码不能为空', trigger: 'blur' }],
loginName: [{ required: true, message: '登录名不能为空', trigger: 'blur' }], const adminInfo = useAdminInfo()
casualUser: [{ required: true, message: '用户类型不能为空', trigger: 'blur' }], const tableStore = inject('tableStore') as TableStore
smsNotice: [{ required: true, message: '短信通知不能为空', trigger: 'blur' }], // do not use same name with ref
emailNotice: [{ required: true, message: '邮件通知不能为空', trigger: 'blur' }], const form = reactive({
email: [ id: '',
{ required: false, message: '邮箱不能为空', trigger: 'blur' }, name: '',
{ password: '123456',
type: 'email', email: '',
message: "'请输入正确的邮箱地址", limitIpStart: '',
trigger: ['blur', 'change'] deptId: '',
} deptName: '',
], casualUser: 1,
phone: [ loginName: '',
{ required: false, message: '手机号不能为空', trigger: 'blur' }, phone: '',
{ limitIpEnd: '',
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, limitTime: [1, 2],
message: '请输入正确的手机号码', role: [],
trigger: 'blur' smsNotice: 0,
} emailNotice: 0,
], type: 0
limitTime: [{ required: true, message: '时间段不能为空', trigger: 'blur' }], })
limitIpStart: [ const formRef = ref()
{ required: true, message: '起始IP不能为空', trigger: 'blur' }, const rules: Partial<Record<string, Arrayable<FormItemRule>>> = {
{ name: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
required: true, role: [{ required: true, message: '请输入角色', trigger: 'blur' }],
validator: (rule: any, value: string, callback: any) => { password: [{ required: true, message: '请输入用户密码', trigger: 'blur' }],
let regexp = /^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}$/ loginName: [{ required: true, message: '请输入登录名', trigger: 'blur' }],
let isCorrect = regexp.test(value) casualUser: [{ required: true, message: '请输入用户类型', trigger: 'blur' }],
if (value == '') { smsNotice: [{ required: true, message: '请输入短信通知', trigger: 'blur' }],
return callback(new Error('请输入IP地址')) emailNotice: [{ required: true, message: '请输入邮件通知', trigger: 'blur' }],
} else if (!isCorrect) { email: [
callback(new Error('请输入正确的IP地址')) { required: false, message: '请输入邮箱', trigger: 'blur' },
} else { {
callback() type: 'email',
} message: "'请输入正确的邮箱地址",
}, trigger: ['blur', 'change']
trigger: 'blur' }
} ],
], phone: [
limitIpEnd: [ { required: false, message: '请输入手机号', trigger: 'blur' },
{ required: true, message: '结束IP不能为空', trigger: 'blur' }, {
{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
required: true, message: '请输入正确的手机号码',
validator: (rule: any, value: string, callback: any) => { trigger: 'blur'
let regexp = /^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}$/ }
let isCorrect = regexp.test(value) ],
if (value == '') { limitTime: [{ required: true, message: '请选择时间段', trigger: 'blur' }],
return callback(new Error('请输入IP地址')) limitIpStart: [
} else if (!isCorrect) { { required: true, message: '请输入起始IP', trigger: 'blur' },
callback(new Error('请输入正确的IP地址')) {
} else { required: true,
callback() validator: (rule: any, value: string, callback: any) => {
} let regexp = /^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}$/
}, let isCorrect = regexp.test(value)
trigger: 'blur' if (value == '') {
} return callback(new Error('请输入IP地址'))
] } else if (!isCorrect) {
} callback(new Error('请输入正确的IP地址'))
const UserTypeOption = [ } else {
{ label: '管理员', value: 1 }, callback()
{ label: '普通用户', value: 2 } }
] },
const TypeOptions = [ trigger: 'blur'
{ label: '临时用户', value: 0 }, }
{ label: '长期用户', value: 1 } ],
] limitIpEnd: [
const useId = ref(1) { required: true, message: '请输入结束IP', trigger: 'blur' },
const roleOptions = ref<treeData>() {
const queryRole = () => { required: true,
roleList(adminInfo.$state.userType).then((res: any) => { validator: (rule: any, value: string, callback: any) => {
roleOptions.value = res.data.map((item: any) => { let regexp = /^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}$/
return { let isCorrect = regexp.test(value)
label: item.name, if (value == '') {
value: item.id return callback(new Error('请输入IP地址'))
} } else if (!isCorrect) {
}) callback(new Error('请输入正确的IP地址'))
}) } else {
} callback()
queryRole() }
const dialogVisible = ref(false) },
const title = ref('新增菜单') trigger: 'blur'
const open = (text: string, data?: anyObj) => { }
title.value = text ]
dialogVisible.value = true }
if (data) { const UserTypeOption = [
for (let key in form) { { label: '管理员', value: 1 },
form[key] = data[key] { label: '普通用户', value: 2 }
} ]
form.limitTime = data.limitTime.split('-') const TypeOptions = [
form.role = data.roleList { label: '临时用户', value: 0 },
} else { { label: '长期用户', value: 1 }
for (let key in form) { ]
form[key] = '' const useId = ref(1)
} const roleOptions = ref<treeData>()
form.casualUser = 1 const queryRole = () => {
form.limitTime = [0, 24] roleList(adminInfo.$state.userType).then((res: any) => {
form.role = [] roleOptions.value = res.data.map((item: any) => {
form.smsNotice = 0 return {
form.emailNotice = 0 label: item.name,
useId.value = 1 value: item.id
form.id = '' }
form.limitIpStart = '0.0.0.0' })
form.limitIpEnd = '255.255.255.255' })
form.password = '123456' }
} queryRole()
form.type = adminInfo.$state.userType + 1 const dialogVisible = ref(false)
} const title = ref('新增菜单')
const submit = async () => { const open = (text: string, data?: anyObj) => {
let obj = JSON.parse(JSON.stringify(form)) formRef.value?.resetFields()
obj.limitTime = obj.limitTime.join('-') title.value = text
delete obj.password dialogVisible.value = true
if (form.id) {
await edit(obj) if (data) {
ElMessage.success('修改成功') for (let key in form) {
} else { form[key] = data[key]
form.type = adminInfo.$state.userType + 1 }
await add(obj) form.limitTime = data.limitTime.split('-')
ElMessage.success('新增成功') form.role = data.roleList
} } else {
tableStore.index() for (let key in form) {
dialogVisible.value = false form[key] = ''
} }
form.casualUser = 1
const changeValue = () => { } form.limitTime = [0, 24]
defineExpose({ open }) form.role = []
</script> form.smsNotice = 0
form.emailNotice = 0
useId.value = 1
form.id = ''
form.limitIpStart = '0.0.0.0'
form.limitIpEnd = '255.255.255.255'
form.password = '123456'
form.type = adminInfo.$state.userType + 1
}
}
const submit = async () => {
formRef.value.validate(async (valid: any) => {
if (valid) {
let obj = JSON.parse(JSON.stringify(form))
obj.limitTime = obj.limitTime.join('-')
delete obj.password
if (form.id) {
await edit(obj)
ElMessage.success('修改成功')
} else {
form.type = adminInfo.$state.userType + 1
await add(obj)
ElMessage.success('新增成功')
}
tableStore.index()
dialogVisible.value = false
}
})
}
const changeValue = () => {}
defineExpose({ open })
</script>

View File

@@ -9,7 +9,7 @@
@change="sourceChange" @change="sourceChange"
:options="deviceTreeOptions" :options="deviceTreeOptions"
:show-all-levels="false" :show-all-levels="false"
:props="{ checkStrictly: true }" :props="{ checkStrictly: true, value: 'id', label: 'name' }"
clearable clearable
></el-cascader> ></el-cascader>
<!-- <el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.searchValue" placeholder="请输入设备名称" /> --> <!-- <el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.searchValue" placeholder="请输入设备名称" /> -->
@@ -57,17 +57,33 @@ const tabsList = ref([
]) ])
const rankOptions = ref([ const rankOptions = ref([
{ {
value: '1', value: '1,7',
label: '1级' label: '1级(ERROR)'
}, },
{ {
value: '2', value: '2,6',
label: '2级' label: '2级(WARN)'
}, },
{ {
value: '3', value: '3,4,5',
label: '3级' label: '3级(DEBUG,NORMAL)'
} },
// {
// value: '4',
// label: 'DEBUG'
// },
// {
// value: '5',
// label: 'NORMAL'
// },
// {
// value: '6',
// label: 'WARN'
// },
// {
// value: '7',
// label: 'ERROR'
// }
]) ])
const tableStore = new TableStore({ const tableStore = new TableStore({
@@ -83,14 +99,15 @@ const tableStore = new TableStore({
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1 return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
} }
}, },
{ title: '设备名称', field: 'equipmentName', align: 'center',minWidth: 100 }, { title: '设备名称', field: 'equipmentName', align: 'center', width: 120 },
{ title: '工程名称', field: 'engineeringName', align: 'center',minWidth: 100 }, { title: '工程名称', field: 'engineeringName', align: 'center', width: 120 },
{ title: '项目名称', field: 'projectName', align: 'center',minWidth: 100 }, { title: '项目名称', field: 'projectName', align: 'center', width: 120 },
{ title: '发生时刻', field: 'startTime', align: 'center', minWidth: 180, sortable: true }, { title: '发生时刻', field: 'startTime', align: 'center', width: 180, sortable: true },
{ {
title: '模块信息', title: '模块信息',
field: 'moduleNo', field: 'moduleNo',
align: 'center',minWidth: 100 , align: 'center',
width: 100,
formatter: (row: any) => { formatter: (row: any) => {
return row.cellValue ? row.cellValue : '/' return row.cellValue ? row.cellValue : '/'
} }
@@ -116,14 +133,24 @@ const tableStore = new TableStore({
width: 100, width: 100,
render: 'tag', render: 'tag',
custom: { custom: {
// 1:Ⅰ级 2:Ⅱ级 3:Ⅲ级 4:DEBUG 5:NORMAL 6:WARN 7:ERROR
1: 'danger', 1: 'danger',
2: 'warning', 2: 'warning',
3: 'success' 3: 'success',
4: 'warning',
5: 'success',
6: 'warning',
7: 'danger'
}, },
replaceValue: { replaceValue: {
1: '1级', 1: '1级',
2: '2级', 2: '2级',
3: '3级' 3: '3级',
4: 'DEBUG',
5: 'NORMAL',
6: 'WARN',
7: 'ERROR'
} }
} }
// { // {
@@ -135,7 +162,25 @@ const tableStore = new TableStore({
// } // }
], ],
beforeSearchFun: () => {}, beforeSearchFun: () => {},
exportProcessingData: () => {
tableStore.table.allData = tableStore.table.allData.filter(item => {
item.level =
item.level == 1
? '1级'
: item.level == 2
? '2级'
: item.level == 3
? '3级'
: item.level == 4
? 'DEBUG'
: item.level == 5
? 'NORMAL'
: item.level == 6
? 'WARN'
: 'ERROR'
return item
})
}
}) })
provide('tableStore', tableStore) provide('tableStore', tableStore)
@@ -177,6 +222,7 @@ const sourceChange = (e: any) => {
tableStore.table.params.deviceTypeId = e[0] || '' tableStore.table.params.deviceTypeId = e[0] || ''
tableStore.table.params.engineeringid = e[1] || '' tableStore.table.params.engineeringid = e[1] || ''
tableStore.table.params.projectId = e[2] || '' tableStore.table.params.projectId = e[2] || ''
tableStore.table.params.deviceId = e[3] || ''
} }
} }
} }

View File

@@ -1,10 +1,24 @@
<template> <template>
<TableHeader datePicker ref="refheader" showExport> <TableHeader datePicker ref="refheader" showExport>
<template v-slot:select> <template v-slot:select>
<el-form-item label="关键"> <el-form-item label="关键字筛选">
<el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.searchValue" placeholder="请输入前置服务器名称ip" /> <el-input
maxlength="32"
show-word-limit
v-model.trim="tableStore.table.params.searchValue"
placeholder="请输入前置服务器名称ip"
/>
</el-form-item>
<el-form-item label="级别">
<el-select v-model.trim="tableStore.table.params.level" placeholder="请选择级别" clearable>
<el-option
v-for="item in rankOptions"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item> </el-form-item>
</template> </template>
</TableHeader> </TableHeader>
<!-- <div style="height: 300px;"> --> <!-- <div style="height: 300px;"> -->
@@ -21,7 +35,36 @@ import { mainHeight } from '@/utils/layout'
const props = defineProps(['deviceTree']) const props = defineProps(['deviceTree'])
const refheader = ref() const refheader = ref()
const rankOptions = ref([
{
value: '1,7',
label: '1级(ERROR)'
},
{
value: '2,6',
label: '2级(WARN)'
},
{
value: '3,4,5',
label: '3级(DEBUG,NORMAL)'
},
// {
// value: '4',
// label: 'DEBUG'
// },
// {
// value: '5',
// label: 'NORMAL'
// },
// {
// value: '6',
// label: 'WARN'
// },
// {
// value: '7',
// label: 'ERROR'
// }
])
const tableStore = new TableStore({ const tableStore = new TableStore({
url: '/cs-harmonic-boot/eventUser/frontWarnInfo', url: '/cs-harmonic-boot/eventUser/frontWarnInfo',
method: 'POST', method: 'POST',
@@ -35,34 +78,79 @@ const tableStore = new TableStore({
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1 return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
} }
}, },
{ title: '前置服务器名称', field: 'lineId', align: 'center' ,minWidth: 120 }, { title: '前置服务器名称', field: 'lineId', align: 'center', width: 120 },
{ title: '前置服务器ip', field: 'wavePath', align: 'center' ,minWidth: 100 }, { title: '前置服务器ip', field: 'wavePath', align: 'center', width: 120 },
{ title: '进程号', field: 'clDid', align: 'center',minWidth: 60 }, { title: '进程号', field: 'clDid', align: 'center', width: 60 },
{ title: '发生时刻', field: 'startTime', align: 'center', minWidth: 180, sortable: true }, { title: '发生时刻', field: 'startTime', align: 'center', width: 180, sortable: true },
{ {
title: '事件描述', title: '事件描述',
field: 'tag', field: 'tag',
minWidth: 350 minWidth: 350
}, },
{ {
title: '告警代码', title: '告警代码',
field: 'code', field: 'code',
align: 'center',minWidth: 100 , align: 'center',
width: 100,
formatter: (row: any) => { formatter: (row: any) => {
return row.cellValue ? '\u200B' + row.cellValue : '/' return row.cellValue ? '\u200B' + row.cellValue : '/'
}, },
sortable: true sortable: true
}, },
{
title: '级别',
field: 'level',
width: 100,
render: 'tag',
custom: {
// 1:Ⅰ级 2:Ⅱ级 3:Ⅲ级 4:DEBUG 5:NORMAL 6:WARN 7:ERROR
1: 'danger',
2: 'warning',
3: 'success',
4: 'warning',
5: 'success',
6: 'warning',
7: 'danger'
},
replaceValue: {
1: '1级',
2: '2级',
3: '3级',
4: 'DEBUG',
5: 'NORMAL',
6: 'WARN',
7: 'ERROR'
}
}
], ],
beforeSearchFun: () => {} beforeSearchFun: () => {},
exportProcessingData: () => {
tableStore.table.allData = tableStore.table.allData.filter(item => {
item.level =
item.level == 1
? '1级'
: item.level == 2
? '2级'
: item.level == 3
? '3级'
: item.level == 4
? 'DEBUG'
: item.level == 5
? 'NORMAL'
: item.level == 6
? 'WARN'
: 'ERROR'
return item
})
}
}) })
provide('tableStore', tableStore) provide('tableStore', tableStore)
tableStore.table.params.searchValue = '' tableStore.table.params.searchValue = ''
tableStore.table.params.level = ''
const deviceTreeOptions = ref<any>(props.deviceTree) const deviceTreeOptions = ref<any>(props.deviceTree)
deviceTreeOptions.value.map((item: any, index: any) => { deviceTreeOptions.value.map((item: any, index: any) => {
if (item.children.length == 0) { if (item.children.length == 0) {
@@ -76,6 +164,5 @@ onMounted(() => {
setTimeout(() => { setTimeout(() => {
// tableStore.table.height = mainHeight(200).height as any // tableStore.table.height = mainHeight(200).height as any
}, 0) }, 0)
</script> </script>
<style></style> <style></style>

View File

@@ -9,7 +9,7 @@
@change="sourceChange" @change="sourceChange"
:options="deviceTreeOptions" :options="deviceTreeOptions"
:show-all-levels="false" :show-all-levels="false"
:props="{ checkStrictly: true }" :props="{ checkStrictly: true, value: 'id', label: 'name' }"
clearable clearable
></el-cascader> ></el-cascader>
<!-- <el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.searchValue" placeholder="请输入设备名称" /> --> <!-- <el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.searchValue" placeholder="请输入设备名称" /> -->
@@ -133,6 +133,7 @@ const sourceChange = (e: any) => {
tableStore.table.params.deviceTypeId = e[0] || '' tableStore.table.params.deviceTypeId = e[0] || ''
tableStore.table.params.engineeringid = e[1] || '' tableStore.table.params.engineeringid = e[1] || ''
tableStore.table.params.projectId = e[2] || '' tableStore.table.params.projectId = e[2] || ''
tableStore.table.params.deviceId = e[3] || ''
} }
} }
} }

View File

@@ -1,5 +1,5 @@
<template> <template>
<div ref="refheader" v-if="!isWaveCharts"> <div ref="refheader" v-show="!isWaveCharts" style="width: 100%;">
<TableHeader datePicker showExport> <TableHeader datePicker showExport>
<template v-slot:select> <template v-slot:select>
<el-form-item label="数据来源"> <el-form-item label="数据来源">
@@ -10,7 +10,7 @@
v-model.trim="tableStore.table.params.cascader" v-model.trim="tableStore.table.params.cascader"
:options="deviceTreeOptions" :options="deviceTreeOptions"
:show-all-levels="false" :show-all-levels="false"
:props="{ checkStrictly: true }" :props="{ checkStrictly: true, value: 'id', label: 'name' }"
clearable clearable
></el-cascader> ></el-cascader>
<!-- <el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.searchValue" placeholder="请输入设备名称" /> --> <!-- <el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.searchValue" placeholder="请输入设备名称" /> -->
@@ -121,28 +121,30 @@ const tableStore = new TableStore({
method: 'POST', method: 'POST',
publicHeight: 65, publicHeight: 65,
exportName: '暂态事件', exportName: '暂态事件',
column: [ { column: [
{
title: '序号', title: '序号',
width: 80, width: 80,
formatter: (row: any) => { formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1 return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
} }
}, },
{ title: '设备名称', field: 'equipmentName', minWidth: 120,align: 'center' }, { title: '设备名称', field: 'equipmentName', minWidth: 120, align: 'center' },
{ title: '工程名称', field: 'engineeringName', minWidth: 120,align: 'center' }, { title: '工程名称', field: 'engineeringName', minWidth: 120, align: 'center' },
{ title: '项目名称', field: 'projectName', minWidth: 120,align: 'center' }, { title: '项目名称', field: 'projectName', minWidth: 120, align: 'center' },
{ title: '发生时刻', field: 'startTime', align: 'center', minWidth: 180,sortable: true }, { title: '发生时刻', field: 'startTime', align: 'center', minWidth: 180, sortable: true },
{ title: '监测点名称', field: 'lineName', minWidth: 120,align: 'center' }, { title: '监测点名称', field: 'lineName', minWidth: 120, align: 'center' },
{ title: '事件描述', field: 'showName', minWidth: 120,align: 'center' }, { title: '事件描述', field: 'showName', minWidth: 120, align: 'center' },
{ title: '事件发生位置', field: 'evtParamPosition',minWidth: 150, align: 'center' }, { title: '事件发生位置', field: 'evtParamPosition', minWidth: 150, align: 'center' },
{ title: '相别', field: 'evtParamPhase',minWidth: 80, align: 'center' }, { title: '相别', field: 'evtParamPhase', minWidth: 80, align: 'center' },
{ title: '持续时间(s)', field: 'evtParamTm',minWidth: 80, align: 'center',sortable: true }, { title: '持续时间(s)', field: 'evtParamTm', minWidth: 80, align: 'center', sortable: true },
{ title: '暂降(聚升)幅值(%)', minWidth: 100, field: 'evtParamVVaDepth', align: 'center',sortable: true }, { title: '暂降(聚升)幅值(%)', minWidth: 100, field: 'evtParamVVaDepth', align: 'center', sortable: true },
{ {
title: '操作', title: '操作', fixed: 'right',
align: 'center', align: 'center',
width: '180', width: '180',
render: 'buttons', render: 'buttons',
buttons: [ buttons: [
{ {
@@ -153,7 +155,7 @@ const tableStore = new TableStore({
render: 'basicButton', render: 'basicButton',
loading: 'loading1', loading: 'loading1',
disabled: row => { disabled: row => {
return !row.wavePath return !row.wavePath
}, },
click: async row => { click: async row => {
row.loading1 = true row.loading1 = true
@@ -164,9 +166,10 @@ const tableStore = new TableStore({
row.loading1 = false row.loading1 = false
if (res != undefined) { if (res != undefined) {
boxoList.value = row boxoList.value = row
boxoList.value.persistTime = row.evtParamTm
boxoList.value.featureAmplitude = boxoList.value.featureAmplitude =
row.evtParamVVaDepth != '-' ? row.evtParamVVaDepth - 0 : null row.evtParamVVaDepth != '-' ? (row.evtParamVVaDepth - 0) / 100 : null
boxoList.value.systemType = 'ZL' boxoList.value.systemType = 'YPT'
wp.value = res.data wp.value = res.data
} }
loading.value = false loading.value = false
@@ -234,24 +237,24 @@ const tableStore = new TableStore({
icon: 'el-icon-DataLine', icon: 'el-icon-DataLine',
render: 'basicButton', render: 'basicButton',
disabled: row => { disabled: row => {
return row.showName != '未知'; return row.showName != '未知'
} }
}, },
{ {
name: 'edit', name: 'edit',
title: '波形补召', title: '波形补召',
type: 'primary', type: 'primary',
icon: 'el-icon-Check', icon: 'el-icon-Check',
render: 'basicButton', render: 'basicButton',
disabled: row => { disabled: row => {
return row.wavePath || row.showName === '未知'; return row.wavePath || row.showName === '未知'
}, },
click: row => { click: row => {
getFileByEventId(row.id).then(res => { getFileByEventId(row.id).then(res => {
ElMessage.success(res.message) ElMessage.success(res.message)
tableStore.index() tableStore.index()
}) })
} }
} }
] ]
} }
@@ -312,8 +315,8 @@ const sourceChange = (e: any) => {
tableStore.table.params.deviceTypeId = e[0] || '' tableStore.table.params.deviceTypeId = e[0] || ''
tableStore.table.params.engineeringid = e[1] || '' tableStore.table.params.engineeringid = e[1] || ''
tableStore.table.params.projectId = e[2] || '' tableStore.table.params.projectId = e[2] || ''
tableStore.table.params.deviceId = e[3] || ''
} }
} }
// tableStore.table.params.engineeringid = e[1] || '' // tableStore.table.params.engineeringid = e[1] || ''

View File

@@ -7,15 +7,15 @@
<el-tab-pane label="前置告警" name="2"> <el-tab-pane label="前置告警" name="2">
<Front v-if="activeName == '2'" :deviceTree="deviceTree" :key="key" /> <Front v-if="activeName == '2'" :deviceTree="deviceTree" :key="key" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="稳态越限告警" name="3"> <!-- <el-tab-pane label="稳态越限告警" name="3">
<Steady v-if="activeName == '3'" :deviceTree="deviceTree" :key="key" /> <Steady v-if="activeName == '3'" :deviceTree="deviceTree" :key="key" />
</el-tab-pane> </el-tab-pane> -->
<el-tab-pane label="暂态事件" name="4"> <el-tab-pane label="暂态事件" name="4">
<Transient v-if="activeName == '4'" :deviceTree="deviceTree" :key="key" /> <Transient v-if="activeName == '4'" :deviceTree="deviceTree" :key="key" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="异常事件" name="5"> <!-- <el-tab-pane label="异常事件" name="5">
<Abnormal v-if="activeName == '5'" :deviceTree="deviceTree" :key="key" /> <Abnormal v-if="activeName == '5'" :deviceTree="deviceTree" :key="key" />
</el-tab-pane> </el-tab-pane> -->
</el-tabs> </el-tabs>
</div> </div>
</template> </template>
@@ -31,24 +31,25 @@ defineOptions({
name: 'govern/alarm/index' name: 'govern/alarm/index'
}) })
const deviceTree = ref([]) const deviceTree = ref([])
const activeName = ref('1') const activeName = ref('0')
const key = ref(0) const key = ref(0)
getDeviceTree().then(res => { getDeviceTree().then(res => {
res.data.forEach((item: any) => { // res.data.forEach((item: any) => {
item.value = item.id // item.value = item.id
item.label = item.name // item.label = item.name
item.children.forEach((child: any) => { // item.children.forEach((child: any) => {
child.value = child.id // child.value = child.id
child.label = child.name // child.label = child.name
child.children.forEach((grand: any) => { // child.children.forEach((grand: any) => {
grand.value = grand.id // grand.value = grand.id
grand.label = grand.name // grand.label = grand.name
delete grand.children // delete grand.children
}) // })
}) // })
}) // })
deviceTree.value = res.data deviceTree.value = res.data
key.value += 1 key.value += 1
activeName.value = '1'
}) })
onMounted(() => { }) onMounted(() => { })

View File

@@ -14,7 +14,7 @@
v-model.trim="formInline.statisticalId" v-model.trim="formInline.statisticalId"
filterable filterable
@change="frequencyFlag" @change="frequencyFlag"
placeholder="请选择" placeholder="请选择"
> >
<el-option <el-option
v-for="item in zblist" v-for="item in zblist"
@@ -158,6 +158,7 @@ const nodeClick = async (e: anyObj) => {
getDevCapacity(formInline.devId) getDevCapacity(formInline.devId)
.then(res => { .then(res => {
devCapacity.value = res.data devCapacity.value = res.data
search() search()
}) })
.catch(() => { .catch(() => {

View File

@@ -1,294 +1,315 @@
<template> <template>
<div class="default-main"> <div class="default-main">
<div class="analyze-dvr" v-show="!isWaveCharts" :style="{ height: pageHeight.height }" v-loading="loading"> <div class="analyze-dvr" v-show="!isWaveCharts" :style="{ height: pageHeight.height }" v-loading="loading">
<DeviceTree @node-click="nodeClick" @init="nodeClick" @deviceTypeChange="deviceTypeChange"></DeviceTree> <DeviceTree @node-click="nodeClick" @init="nodeClick" @deviceTypeChange="deviceTypeChange"></DeviceTree>
<div class="analyze-dvr-right" v-if="tableStore.table.params.deviceId"> <div class="analyze-dvr-right" v-if="tableStore.table.params.deviceId">
<TableHeader datePicker showExport> <TableHeader datePicker showExport>
<template v-slot:select> <template v-slot:select>
<el-form-item label="事件类型"> <el-form-item label="事件类型">
<el-select <el-select
v-model.trim="tableStore.table.params.eventType" v-model.trim="tableStore.table.params.eventType"
clearable clearable
placeholder="请选择事件类型" placeholder="请选择事件类型"
> >
<el-option <el-option
v-for="item in eventList" v-for="item in eventList"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="位置"> <el-form-item label="位置">
<el-select <el-select
v-model.trim="tableStore.table.params.location" v-model.trim="tableStore.table.params.location"
clearable clearable
placeholder="请选择位置" placeholder="请选择位置"
> >
<el-option <el-option
v-for="item in locationList" v-for="item in locationList"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> </template>
</TableHeader> </TableHeader>
<Table v-if="view" ref="tableRef"></Table> <Table v-if="view" ref="tableRef"></Table>
</div> </div>
<el-empty v-else description="请选择设备" class="analyze-dvr-right" /> <el-empty v-else description="请选择设备" class="analyze-dvr-right" />
</div> </div>
<waveFormAnalysis <waveFormAnalysis
v-loading="loading" v-loading="loading"
v-if="isWaveCharts" v-if="isWaveCharts"
ref="waveFormAnalysisRef" ref="waveFormAnalysisRef"
@handleHideCharts="isWaveCharts = false" @handleHideCharts="isWaveCharts = false"
:wp="wp" :wp="wp"
style="padding: 10px" style="padding: 10px"
/> />
<!-- <div :style="{ height: pageHeight.height }" style="padding: 10px; overflow: hidden" v-if="!view"> <!-- <div :style="{ height: pageHeight.height }" style="padding: 10px; overflow: hidden" v-if="!view">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<div v-if="view2" style="display: flex"> <div v-if="view2" style="display: flex">
<el-radio-group v-model.trim="value" @change="changeView"> <el-radio-group v-model.trim="value" @change="changeView">
<el-radio-button label="一次值" :value="1" /> <el-radio-button label="一次值" :value="1" />
<el-radio-button label="二次值" :value="2" /> <el-radio-button label="二次值" :value="2" />
</el-radio-group> </el-radio-group>
</div> </div>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-button v-if="view2" @click="backbxlb" class="el-icon-refresh-right" icon="el-icon-Back" <el-button v-if="view2" @click="backbxlb" class="el-icon-refresh-right" icon="el-icon-Back"
style="float: right"> style="float: right">
返回 返回
</el-button> </el-button>
</el-col> </el-col>
</el-row> </el-row>
<el-tabs v-if="view2" class="default-main" v-model.trim="bxactiveName" @tab-click="bxhandleClick"> <el-tabs v-if="view2" class="default-main" v-model.trim="bxactiveName" @tab-click="bxhandleClick">
<el-tab-pane label="瞬时波形" name="ssbx" class="boxbx pt10 pb10" <el-tab-pane label="瞬时波形" name="ssbx" class="boxbx pt10 pb10"
:style="'height:' + bxecharts + ';overflow-y: scroll;'"> :style="'height:' + bxecharts + ';overflow-y: scroll;'">
<shushiboxi v-if="bxactiveName == 'ssbx' && showBoxi" :value="value" :boxoList="boxoList" :wp="wp"> <shushiboxi v-if="bxactiveName == 'ssbx' && showBoxi" :value="value" :boxoList="boxoList" :wp="wp">
</shushiboxi> </shushiboxi>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="RMS波形" class="boxbx pt10 pb10" name="rmsbx" <el-tab-pane label="RMS波形" class="boxbx pt10 pb10" name="rmsbx"
:style="'height:' + bxecharts + ';overflow-y: scroll;'"> :style="'height:' + bxecharts + ';overflow-y: scroll;'">
<rmsboxi v-if="bxactiveName == 'rmsbx' && showBoxi" :value="value" :boxoList="boxoList" :wp="wp"> <rmsboxi v-if="bxactiveName == 'rmsbx' && showBoxi" :value="value" :boxoList="boxoList" :wp="wp">
</rmsboxi> </rmsboxi>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> --> </div> -->
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, nextTick, provide, onMounted } from 'vue' import { ref, nextTick, provide, onMounted } from 'vue'
import { mainHeight } from '@/utils/layout' import { mainHeight } from '@/utils/layout'
import DeviceTree from '@/components/tree/govern/deviceTree.vue' import DeviceTree from '@/components/tree/govern/deviceTree.vue'
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue' import Table from '@/components/table/index.vue'
import waveFormAnalysis from '@/views/govern/device/control/tabs/components/waveFormAnalysis.vue' import waveFormAnalysis from '@/views/govern/device/control/tabs/components/waveFormAnalysis.vue'
import { analyseWave } from '@/api/common' import { analyseWave } from '@/api/common'
import TableHeader from '@/components/table/header/index.vue' import TableHeader from '@/components/table/header/index.vue'
import { getFileZip } from '@/api/cs-harmonic-boot/datatrend' import { getFileZip } from '@/api/cs-harmonic-boot/datatrend'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
defineOptions({ defineOptions({
name: 'govern/analyze/DVR/index' name: 'govern/analyze/DVR/index'
}) })
const pageHeight = mainHeight(20) const pageHeight = mainHeight(20)
const loading = ref(false) const loading = ref(false)
const view = ref(true) const view = ref(true)
const view2 = ref(false) const view2 = ref(false)
const showBoxi = ref(true) const showBoxi = ref(true)
const isWaveCharts = ref(false) const isWaveCharts = ref(false)
const bxactiveName = ref('ssbx') const bxactiveName = ref('ssbx')
const boxoList: any = ref({}) const boxoList: any = ref({})
const wp = ref({}) const wp = ref({})
const eventList = ref([ const eventList = ref([
{ {
value: 'Evt_Sys_DipStr', value: 'Evt_Sys_DipStr',
label: '电压暂降' label: '电压暂降'
}, },
{ {
value: 'Evt_Sys_SwlStr', value: 'Evt_Sys_SwlStr',
label: '电压暂升' label: '电压暂升'
}, },
{ {
value: 'Evt_Sys_IntrStr', value: 'Evt_Sys_IntrStr',
label: '电压中断' label: '电压中断'
} }
]) ])
const locationList = ref([ const locationList = ref([
{ {
value: 'grid', value: 'grid',
label: '电网侧' label: '电网侧'
}, },
{ {
value: 'load', value: 'load',
label: '负载侧' label: '负载侧'
} }
]) ])
const waveFormAnalysisRef = ref() const waveFormAnalysisRef = ref()
const tableStore = new TableStore({ const tableStore = new TableStore({
url: '/cs-harmonic-boot/eventUser/queryEventpageWeb', url: '/cs-harmonic-boot/eventUser/queryEventpageWeb',
method: 'POST', method: 'POST',
column: [ column: [
{ title: '事件描述', field: 'showName' }, {
{ title: '发生位置', field: 'evtParamPosition' }, field: 'index',
{ title: '持续时间(s)', field: 'evtParamTm', sortable: true }, title: '序号',
{ width: '80',
title: '暂降(聚升)幅值(%)', formatter: (row: any) => {
field: 'evtParamVVaDepth', return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
formatter: (row: any) => { }
let a = row.cellValue.split('%')[0] - 0 },
console.log('🚀 ~ a:', a) { title: '事件描述', field: 'showName', minWidth: 150 },
return a ? a.toFixed(2) : '/' { title: '发生位置', field: 'evtParamPosition', minWidth: 150 },
}, sortable: true {
}, title: '持续时间(s)',
{ title: '发生时刻', field: 'startTime', sortable: true }, field: 'evtParamTm',
{ sortable: true,
title: '操作', minWidth: 110,
align: 'center', formatter: (row: any) => {
width: '180', return Math.floor(row.cellValue * 10000) / 100
render: 'buttons', }
buttons: [ },
{ {
name: 'edit', title: '暂降(聚升)幅值(%)',
text: '波形分析', field: 'evtParamVVaDepth',
type: 'primary', minWidth: 150,
icon: 'el-icon-DataLine', formatter: (row: any) => {
render: 'basicButton', let a = row.cellValue.split('%')[0] - 0
disabled: row => { return a ? a.toFixed(2) : '/'
return !row.wavePath && row.evtParamTm < 20 },
}, sortable: true
},
click: async row => { { title: '发生时刻', field: 'startTime', sortable: true, minWidth: 180 },
row.loading1 = true {
loading.value = true title: '操作',
isWaveCharts.value = true fixed: 'right',
await analyseWave(row.id) align: 'center',
.then(res => { width: '180',
row.loading1 = false render: 'buttons',
if (res != undefined) { buttons: [
boxoList.value = row {
boxoList.value.featureAmplitude = name: 'edit',
row.evtParamVVaDepth != '-' ? row.evtParamVVaDepth - 0 : null text: '波形分析',
// boxoList.value.systemType = 'WX' type: 'primary',
wp.value = res.data icon: 'el-icon-DataLine',
} render: 'basicButton',
loading.value = false disabled: row => {
}) return !row.wavePath && row.evtParamTm < 20
.catch(() => { },
row.loading1 = false
loading.value = false click: async row => {
}) row.loading1 = true
loading.value = true
nextTick(() => { isWaveCharts.value = true
waveFormAnalysisRef.value && await analyseWave(row.id)
waveFormAnalysisRef.value.getWpData(wp.value, boxoList.value, true) .then(res => {
waveFormAnalysisRef.value && waveFormAnalysisRef.value.setHeight(false, 150) row.loading1 = false
}) if (res != undefined) {
} boxoList.value = row
}, boxoList.value.featureAmplitude =
{ row.evtParamVVaDepth != '-' ? row.evtParamVVaDepth.split('%')[0] / 100 : null
name: 'edit', boxoList.value.persistTime =
text: '暂无波形', row.evtParamTm != '-' ? Math.floor(row.evtParamTm * 10000) / 100 : null
type: 'info', // boxoList.value.systemType = 'WX'
icon: 'el-icon-DataLine', boxoList.value.systemType = 'YPT'
render: 'basicButton', wp.value = res.data
disabled: row => { }
return !(!row.wavePath && row.evtParamTm < 20) loading.value = false
} })
}, .catch(() => {
{ row.loading1 = false
name: 'edit', loading.value = false
title: '波形下载', })
type: 'primary',
icon: 'el-icon-Check', nextTick(() => {
loading: 'loading2', waveFormAnalysisRef.value &&
render: 'basicButton', waveFormAnalysisRef.value.getWpData(wp.value, boxoList.value, true)
disabled: row => { waveFormAnalysisRef.value && waveFormAnalysisRef.value.setHeight(false, 150)
// && row.evtParamTm < 20 })
return !row.wavePath }
}, },
click: row => { {
getFileZip({ eventId: row.id }).then(res => { name: 'edit',
let blob = new Blob([res], { type: 'application/zip' }) // console.log(blob) // var href = window.URL.createObjectURL(blob); //创建下载的链接 text: '暂无波形',
const url = window.URL.createObjectURL(blob) type: 'info',
const link = document.createElement('a') // 创建a标签 icon: 'el-icon-DataLine',
link.href = url render: 'basicButton',
link.download = row.wavePath.split('/')[2] || '波形文件' // 设置下载的文件名 disabled: row => {
document.body.appendChild(link) return !(!row.wavePath && row.evtParamTm < 20)
link.click() //执行下载 }
document.body.removeChild(link) //释放标签 },
}) {
} name: 'edit',
} title: '波形下载',
] type: 'primary',
} icon: 'el-icon-Check',
], loading: 'loading2',
loadCallback: () => { render: 'basicButton',
tableStore.table.data.forEach((item: any) => { disabled: row => {
item.loading = false // && row.evtParamTm < 20
item.evtParamTm = item.evtParamTm.split('s')[0] return !row.wavePath
}) },
} click: row => {
}) getFileZip({ eventId: row.id }).then(res => {
const flag = ref(false) let blob = new Blob([res], { type: 'application/zip' }) // console.log(blob) // var href = window.URL.createObjectURL(blob); //创建下载的链接
tableStore.table.params.type = 0 const url = window.URL.createObjectURL(blob)
tableStore.table.params.eventType = '' const link = document.createElement('a') // 创建a标签
tableStore.table.params.location = '' link.href = url
provide('tableStore', tableStore) link.download = row.wavePath.split('/')[2] || '波形文件' // 设置下载的文件名
const deviceTypeChange = (val: any, obj: any) => { document.body.appendChild(link)
flag.value = true link.click() //执行下载
nodeClick(obj) document.body.removeChild(link) //释放标签
} })
const nodeClick = async (e: anyObj) => { }
// console.log("🚀 ~ nodeClick ~ e:", e) }
if (e.level == 2&& flag.value) { ]
loading.value = false }
tableStore.table.params.deviceId = e.id ],
nextTick(() => { loadCallback: () => {
tableStore.index() tableStore.table.data.forEach((item: any) => {
}) item.loading = false
} item.evtParamTm = item.evtParamTm.split('s')[0]
} })
}
const changeView = () => { })
showBoxi.value = false const flag = ref(false)
setTimeout(() => { tableStore.table.params.type = 0
showBoxi.value = true tableStore.table.params.eventType = ''
}, 0) tableStore.table.params.location = ''
} provide('tableStore', tableStore)
const bxhandleClick = (tab: any) => { const deviceTypeChange = (val: any, obj: any) => {
if (tab.name == 'ssbx') { flag.value = true
bxactiveName.value = 'ssbx' nodeClick(obj)
} else if (tab.name == 'rmsbx') { }
bxactiveName.value = 'rmsbx' const nodeClick = async (e: anyObj) => {
} // console.log("🚀 ~ nodeClick ~ e:", e)
// console.log(tab, event); if (e.level == 2 && flag.value) {
} loading.value = false
const backbxlb = () => { tableStore.table.params.deviceId = e.id
view.value = true nextTick(() => {
view2.value = false tableStore.index()
} })
const bxecharts = mainHeight(95).height as any }
</script> }
<style lang="scss"> const changeView = () => {
.analyze-dvr { showBoxi.value = false
display: flex; setTimeout(() => {
showBoxi.value = true
&-right { }, 0)
height: 100%; }
overflow: hidden; const bxhandleClick = (tab: any) => {
flex: 1; if (tab.name == 'ssbx') {
padding: 10px 10px 10px 0; bxactiveName.value = 'ssbx'
display: flex; } else if (tab.name == 'rmsbx') {
flex-direction: column; bxactiveName.value = 'rmsbx'
} }
} // console.log(tab, event);
</style> }
const backbxlb = () => {
view.value = true
view2.value = false
}
const bxecharts = mainHeight(95).height as any
</script>
<style lang="scss">
.analyze-dvr {
display: flex;
&-right {
height: 100%;
overflow: hidden;
flex: 1;
padding: 10px 10px 10px 0;
display: flex;
flex-direction: column;
}
}
</style>

View File

@@ -89,6 +89,7 @@
:rules="{ required: true, message: '请输入设备名称', trigger: 'blur' }" :rules="{ required: true, message: '请输入设备名称', trigger: 'blur' }"
> >
<el-select <el-select
clearable
filterable filterable
v-model="project[2].name" v-model="project[2].name"
:disabled="true" :disabled="true"
@@ -108,11 +109,12 @@
id="id200" id="id200"
class="form-item" class="form-item"
label="省:" label="省:"
prop="engineeringParam.province" prop="engineeringParam.province"
v-if="nodeLevel > 0 || pageStatus == 2" v-if="nodeLevel > 0 || pageStatus == 2"
:rules="{ required: true, message: '请选择省', trigger: 'change' }" :rules="{ required: true, message: '请选择省', trigger: 'change' }"
> >
<el-select <el-select
clearable
filterable filterable
v-model="formData.engineeringParam.province" v-model="formData.engineeringParam.province"
:disabled=" :disabled="
@@ -134,11 +136,12 @@
id="id200" id="id200"
class="form-item" class="form-item"
label="市:" label="市:"
prop="engineeringParam.city" prop="engineeringParam.city"
v-if="nodeLevel > 0 || pageStatus == 2" v-if="nodeLevel > 0 || pageStatus == 2"
:rules="{ required: true, message: '请选择市', trigger: 'change' }" :rules="{ required: true, message: '请选择市', trigger: 'change' }"
> >
<el-select <el-select
clearable
filterable filterable
v-model="formData.engineeringParam.city" v-model="formData.engineeringParam.city"
:disabled=" :disabled="
@@ -158,12 +161,12 @@
id="id300" id="id300"
class="form-item" class="form-item"
label="工程名称:" label="工程名称:"
v-if="nodeLevel > 0 || pageStatus == 2" v-if="nodeLevel > 0 || pageStatus == 2"
prop="engineeringParam.name" prop="engineeringParam.name"
:rules="{ required: true, message: '请输入工程名称', trigger: 'blur' }" :rules="{ required: true, message: '请输入工程名称', trigger: 'blur' }"
> >
<el-input <el-input
clearable
v-model="formData.engineeringParam.name" v-model="formData.engineeringParam.name"
placeholder="请输入工程名称" placeholder="请输入工程名称"
:disabled=" :disabled="
@@ -175,10 +178,11 @@
id="id300" id="id300"
class="form-item" class="form-item"
label="描述:" label="描述:"
prop="engineeringParam.description" prop="engineeringParam.description"
v-if="nodeLevel > 0 || pageStatus == 2" v-if="nodeLevel > 0 || pageStatus == 2"
> >
<el-input <el-input
clearable
v-model="formData.engineeringParam.description" v-model="formData.engineeringParam.description"
placeholder="请输入描述" placeholder="请输入描述"
:disabled=" :disabled="
@@ -212,6 +216,7 @@
]" ]"
> >
<el-input <el-input
clearable
v-model="item.name" v-model="item.name"
placeholder="请输入项目名称" placeholder="请输入项目名称"
:disabled=" :disabled="
@@ -225,13 +230,14 @@
</el-form-item> </el-form-item>
<el-form-item <el-form-item
class="form-item" class="form-item"
label="地:" label="地:"
:prop="'projectInfoList[' + index + '].area'" :prop="'projectInfoList[' + index + '].area'"
:rules="[{ required: true, message: '请输入地', trigger: 'blur' }]" :rules="[{ required: true, message: '请输入地', trigger: 'blur' }]"
> >
<el-input <el-input
clearable
v-model="item.area" v-model="item.area"
placeholder="请输入地" placeholder="请输入地"
:disabled=" :disabled="
!( !(
(nodeLevel == 2 && pageStatus == 3) || (nodeLevel == 2 && pageStatus == 3) ||
@@ -248,6 +254,7 @@
:rules="[{ required: true, message: '请输入描述', trigger: 'blur' }]" :rules="[{ required: true, message: '请输入描述', trigger: 'blur' }]"
> >
<el-input <el-input
clearable
v-model="item.description" v-model="item.description"
placeholder="请输入描述" placeholder="请输入描述"
:disabled=" :disabled="
@@ -293,6 +300,7 @@
]" ]"
> >
<el-input <el-input
clearable
v-model="busItem.name" v-model="busItem.name"
placeholder="请输入装置名称" placeholder="请输入装置名称"
:disabled=" :disabled="
@@ -308,12 +316,13 @@
id="id200" id="id200"
class="form-item" class="form-item"
label="装置类型:" label="装置类型:"
:prop="'deviceInfoList[' + bIndex + '].devType'" :prop="'deviceInfoList[' + bIndex + '].devType'"
:rules="[ :rules="[
{ required: true, message: '请选择装置类型', trigger: 'change' } { required: true, message: '请选择装置类型', trigger: 'change' }
]" ]"
> >
<el-select <el-select
clearable
filterable filterable
v-model="busItem.devType" v-model="busItem.devType"
placeholder="请选择装置类型" placeholder="请选择装置类型"
@@ -338,12 +347,13 @@
id="id200" id="id200"
class="form-item" class="form-item"
label="装置型号:" label="装置型号:"
:prop="'deviceInfoList[' + bIndex + '].devModel'" :prop="'deviceInfoList[' + bIndex + '].devModel'"
:rules="[ :rules="[
{ required: true, message: '请选择装置型号', trigger: 'change' } { required: true, message: '请选择装置型号', trigger: 'change' }
]" ]"
> >
<el-select <el-select
clearable
filterable filterable
v-model="busItem.devModel" v-model="busItem.devModel"
placeholder="请选择装置型号" placeholder="请选择装置型号"
@@ -368,12 +378,13 @@
id="id200" id="id200"
class="form-item" class="form-item"
label="装置接入方式:" label="装置接入方式:"
:prop="'deviceInfoList[' + bIndex + '].devAccessMethod'" :prop="'deviceInfoList[' + bIndex + '].devAccessMethod'"
:rules="[ :rules="[
{ required: true, message: '请选择装置接入方式', trigger: 'change' } { required: true, message: '请选择装置接入方式', trigger: 'change' }
]" ]"
> >
<el-select <el-select
clearable
filterable filterable
v-model="busItem.devAccessMethod" v-model="busItem.devAccessMethod"
placeholder="请选择装置接入方式" placeholder="请选择装置接入方式"
@@ -393,7 +404,7 @@
<el-form-item <el-form-item
class="form-item" class="form-item"
label="装置mac地址:" label="装置mac地址:"
:prop="'deviceInfoList[' + bIndex + '].mac'" :prop="'deviceInfoList[' + bIndex + '].mac'"
:rules="{ :rules="{
required: true, required: true,
message: '请输入装置mac地址', message: '请输入装置mac地址',
@@ -411,14 +422,19 @@
:rules="[{ required: true, message: '请输入网络设备ID', trigger: 'blur' }]" :rules="[{ required: true, message: '请输入网络设备ID', trigger: 'blur' }]"
> >
<el-input <el-input clearable
v-model="busItem.ndid" v-model="busItem.ndid"
disabled disabled
placeholder="请输入网络设备ID" placeholder="请输入网络设备ID"
></el-input> ></el-input>
</el-form-item> --> </el-form-item> -->
<el-form-item class="form-item" label="合同号:" :prop="'deviceInfoList[' + bIndex + '].cntractNo'"> <el-form-item
class="form-item"
label="合同号:"
:prop="'deviceInfoList[' + bIndex + '].cntractNo'"
>
<el-input <el-input
clearable
v-model="busItem.cntractNo" v-model="busItem.cntractNo"
placeholder="请输入合同号" placeholder="请输入合同号"
:disabled=" :disabled="
@@ -433,12 +449,13 @@
<el-form-item <el-form-item
class="form-item" class="form-item"
label="所属前置机:" label="所属前置机:"
:prop="'deviceInfoList[' + bIndex + '].nodeId'" :prop="'deviceInfoList[' + bIndex + '].nodeId'"
:rules="[ :rules="[
{ required: true, message: '请选择所属前置机', trigger: 'change' } { required: true, message: '请选择所属前置机', trigger: 'change' }
]" ]"
> >
<el-select <el-select
clearable
filterable filterable
v-model="busItem.nodeId" v-model="busItem.nodeId"
placeholder="请选择所属前置机" placeholder="请选择所属前置机"
@@ -452,14 +469,45 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item class="form-item" label="进程号:" :prop="'deviceInfoList[' + bIndex + '].nodeProcess'"> <el-form-item
class="form-item"
label="进程号:"
:prop="'deviceInfoList[' + bIndex + '].nodeProcess'"
>
<el-input <el-input
clearable
v-model="busItem.nodeProcess" v-model="busItem.nodeProcess"
placeholder="自动分配" placeholder="自动分配"
:disabled="true" :disabled="true"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item
class="form-item"
label="日志等级:"
:prop="'deviceInfoList[' + bIndex + '].devLogLevel'"
>
<el-select
clearable
filterable
v-model="busItem.devLogLevel"
placeholder="请选择日志等级"
style="width: 100%"
:disabled="
!(
(nodeLevel == 3 && pageStatus == 3) ||
((nodeLevel == 2 || (nodeLevel == 1 && pageStatus == 2)) &&
pageStatus == 2)
)
"
>
<el-option
v-for="value in logList"
:key="value.value"
:label="value.label"
:value="value.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item <el-form-item
class="form-item" class="form-item"
label="排序:" label="排序:"
@@ -467,6 +515,7 @@
:rules="[{ required: true, message: '请输入排序', trigger: 'blur' }]" :rules="[{ required: true, message: '请输入排序', trigger: 'blur' }]"
> >
<el-input <el-input
clearable
v-model="busItem.sort" v-model="busItem.sort"
placeholder="请输入排序" placeholder="请输入排序"
:disabled=" :disabled="
@@ -514,6 +563,7 @@
}" }"
> >
<el-input <el-input
clearable
v-model="lineItem.name" v-model="lineItem.name"
placeholder="请输入监测点名称" placeholder="请输入监测点名称"
:disabled=" :disabled="
@@ -536,6 +586,7 @@
}" }"
> >
<el-select <el-select
clearable
filterable filterable
v-model="lineItem.lineNo" v-model="lineItem.lineNo"
placeholder="请选择线路号" placeholder="请选择线路号"
@@ -562,6 +613,7 @@
:rules="{ required: true, message: '请选择接线方式', trigger: 'blur' }" :rules="{ required: true, message: '请选择接线方式', trigger: 'blur' }"
> >
<el-select <el-select
clearable
filterable filterable
v-model="lineItem.conType" v-model="lineItem.conType"
placeholder="请选择接线方式" placeholder="请选择接线方式"
@@ -588,6 +640,7 @@
:rules="{ required: true, message: '请选择统计间隔', trigger: 'blur' }" :rules="{ required: true, message: '请选择统计间隔', trigger: 'blur' }"
> >
<el-select <el-select
clearable
filterable filterable
v-model="lineItem.lineInterval" v-model="lineItem.lineInterval"
placeholder="请选择统计间隔" placeholder="请选择统计间隔"
@@ -614,11 +667,13 @@
:rules="{ required: true, message: '请输入pt', trigger: 'blur' }" :rules="{ required: true, message: '请输入pt', trigger: 'blur' }"
> >
<div style="width: 100%; display: flex; justify-content: space-between"> <div style="width: 100%; display: flex; justify-content: space-between">
<el-input-number <el-input
clearable-number
:controls="false" :controls="false"
:min="1" :min="1"
style="width: 48%" style="width: 48%"
v-model="lineItem.ptRatio" oninput="value=value.replace(/[^\d]/g,'')"
v-model.number="lineItem.ptRatio"
:disabled=" :disabled="
!( !(
(nodeLevel == 4 && pageStatus == 3) || (nodeLevel == 4 && pageStatus == 3) ||
@@ -627,7 +682,7 @@
pageStatus == 2) pageStatus == 2)
) )
" "
></el-input-number> ></el-input>
<span <span
style=" style="
display: flex; display: flex;
@@ -637,11 +692,13 @@
> >
: :
</span> </span>
<el-input-number <el-input
clearable-number
:controls="false" :controls="false"
:min="1" :min="1"
style="width: 48%" style="width: 48%"
v-model="lineItem.pt2Ratio" oninput="value=value.replace(/[^\d]/g,'')"
v-model.number="lineItem.pt2Ratio"
:disabled=" :disabled="
!( !(
(nodeLevel == 4 && pageStatus == 3) || (nodeLevel == 4 && pageStatus == 3) ||
@@ -650,21 +707,23 @@
pageStatus == 2) pageStatus == 2)
) )
" "
></el-input-number> ></el-input>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
class="form-item" class="form-item"
label="CT变比:" label="CT变比:"
:prop="'lineInfoList[' + lIndex + '].ctRatio'" :prop="'lineInfoList[' + lIndex + '].ctRatio'"
:rules="{ required: true, message: '请输入ct', trigger: 'blur' }" :rules="{ required: true, message: '请输入ct', trigger: 'blur' }"
> >
<div style="width: 100%; display: flex; justify-content: space-between"> <div style="width: 100%; display: flex; justify-content: space-between">
<el-input-number <el-input
clearable-number
:controls="false" :controls="false"
:min="1" :min="1"
style="width: 48%" style="width: 48%"
v-model="lineItem.ctRatio" oninput="value=value.replace(/[^\d]/g,'')"
v-model.number="lineItem.ctRatio"
:disabled=" :disabled="
!( !(
(nodeLevel == 4 && pageStatus == 3) || (nodeLevel == 4 && pageStatus == 3) ||
@@ -673,7 +732,7 @@
pageStatus == 2) pageStatus == 2)
) )
" "
></el-input-number> ></el-input>
<span <span
style=" style="
display: flex; display: flex;
@@ -683,11 +742,13 @@
> >
: :
</span> </span>
<el-input-number <el-input
clearable-number
:controls="false" :controls="false"
:min="1" :min="1"
style="width: 48%" style="width: 48%"
v-model="lineItem.ct2Ratio" oninput="value=value.replace(/[^\d]/g,'')"
v-model.number="lineItem.ct2Ratio"
:disabled=" :disabled="
!( !(
(nodeLevel == 4 && pageStatus == 3) || (nodeLevel == 4 && pageStatus == 3) ||
@@ -696,12 +757,18 @@
pageStatus == 2) pageStatus == 2)
) )
" "
></el-input-number> ></el-input>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item class="form-item" label="基准容量(MVA):" :prop="'lineInfoList[' + lIndex + '].basicCapacity'" :rules="{ required: true, message: '请输入基准容量', trigger: 'blur' }"> <el-form-item
<el-input-number class="form-item"
label="基准容量(MVA):"
:prop="'lineInfoList[' + lIndex + '].basicCapacity'"
:rules="{ required: true, message: '请输入基准容量', trigger: 'blur' }"
>
<el-input
clearable-number
:controls="false" :controls="false"
:min="0" :min="0"
style="width: 100%" style="width: 100%"
@@ -714,15 +781,16 @@
) )
" "
placeholder="请输入基准容量(MVA)" placeholder="请输入基准容量(MVA)"
></el-input-number> ></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
class="form-item" class="form-item"
label="短路容量(MVA):" label="短路容量(MVA):"
:prop="'lineInfoList[' + lIndex + '].shortCircuitCapacity'" :prop="'lineInfoList[' + lIndex + '].shortCircuitCapacity'"
:rules="{ required: true, message: '请输入短路容量', trigger: 'blur' }" :rules="{ required: true, message: '请输入短路容量', trigger: 'blur' }"
> >
<el-input-number <el-input
clearable-number
:controls="false" :controls="false"
:min="0" :min="0"
style="width: 100%" style="width: 100%"
@@ -735,15 +803,16 @@
) )
" "
placeholder="请输入短路容量(MVA)" placeholder="请输入短路容量(MVA)"
></el-input-number> ></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
class="form-item" class="form-item"
label="设备容量(MW):" label="设备容量(MVA):"
:prop="'lineInfoList[' + lIndex + '].devCapacity'" :prop="'lineInfoList[' + lIndex + '].devCapacity'"
:rules="{ required: true, message: '请输入设备容量', trigger: 'blur' }" :rules="{ required: true, message: '请输入设备容量', trigger: 'blur' }"
> >
<el-input-number <el-input
clearable-number
:controls="false" :controls="false"
:min="0" :min="0"
style="width: 100%" style="width: 100%"
@@ -756,15 +825,16 @@
) )
" "
placeholder="请输入设备容量(MVA)" placeholder="请输入设备容量(MVA)"
></el-input-number> ></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
class="form-item" class="form-item"
label="协议容量(MW):" label="协议容量(MVA):"
:prop="'lineInfoList[' + lIndex + '].protocolCapacity'" :prop="'lineInfoList[' + lIndex + '].protocolCapacity'"
:rules="{ required: true, message: '请输入协议容量', trigger: 'blur' }" :rules="{ required: true, message: '请输入协议容量', trigger: 'blur' }"
> >
<el-input-number <el-input
clearable-number
:controls="false" :controls="false"
:min="0" :min="0"
style="width: 100%" style="width: 100%"
@@ -776,17 +846,18 @@
pageStatus == 2) pageStatus == 2)
) )
" "
placeholder="请输入协议容量(MW)" placeholder="请输入协议容量(MVA)"
></el-input-number> ></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
class="form-item" class="form-item"
label="电压等级:" label="电压等级:"
:prop="'lineInfoList[' + lIndex + '].volGrade'" :prop="'lineInfoList[' + lIndex + '].volGrade'"
:rules="{ required: true, message: '请选择电压等级', trigger: 'blur' }" :rules="{ required: true, message: '请选择电压等级', trigger: 'blur' }"
> >
<el-select <el-select
clearable
filterable filterable
v-model="lineItem.volGrade" v-model="lineItem.volGrade"
placeholder="请选择电压等级" placeholder="请选择电压等级"
@@ -806,13 +877,9 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item class="form-item" label="用户对象:">
class="form-item"
label="用户对象:"
:prop="'lineInfoList[' + lIndex + '].monitorUser'"
:rules="{ required: true, message: '请选择用户对象', trigger: 'blur' }"
>
<el-select <el-select
clearable
filterable filterable
v-model="lineItem.monitorUser" v-model="lineItem.monitorUser"
placeholder="请选择用户对象" placeholder="请选择用户对象"
@@ -835,7 +902,7 @@
<el-form-item <el-form-item
class="form-item" class="form-item"
label="监测对象类型:" label="监测对象类型:"
:prop="'lineInfoList[' + lIndex + '].monitorObj'" :prop="'lineInfoList[' + lIndex + '].monitorObj'"
:rules="{ :rules="{
required: true, required: true,
message: '请选择监测对象类型', message: '请选择监测对象类型',
@@ -843,6 +910,7 @@
}" }"
> >
<el-select <el-select
clearable
filterable filterable
v-model="lineItem.monitorObj" v-model="lineItem.monitorObj"
placeholder="请选择监测对象类型" placeholder="请选择监测对象类型"
@@ -864,11 +932,43 @@
</el-form-item> </el-form-item>
<el-form-item <el-form-item
class="form-item" class="form-item"
label="是否治理:" label="监测位置:"
:prop="'lineInfoList[' + lIndex + '].govern'" :prop="'lineInfoList[' + lIndex + '].position'"
:rules="{ required: true, message: '请选择是否治理', trigger: 'blur' }" :rules="{
required: true,
message: '请选择监测位置',
trigger: 'blur'
}"
> >
<el-select <el-select
clearable
filterable
v-model="lineItem.position"
placeholder="请选择监测位置"
:disabled="
!(
(nodeLevel == 4 && pageStatus == 3) ||
((nodeLevel == 3 || (nodeLevel == 2 && pageStatus == 2)) &&
pageStatus == 2)
)
"
>
<el-option
v-for="option in linePosition"
:key="option.id"
:label="option.name"
:value="option.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
class="form-item"
label="是否治理:"
:prop="'lineInfoList[' + lIndex + '].govern'"
:rules="{ required: true, message: '请选择是否治理', trigger: 'change' }"
>
<el-select
clearable
filterable filterable
v-model="lineItem.govern" v-model="lineItem.govern"
placeholder="请选择是否治理" placeholder="请选择是否治理"
@@ -890,8 +990,9 @@
:prop="'lineInfoList[' + lIndex + '].runStatus'" :prop="'lineInfoList[' + lIndex + '].runStatus'"
:rules="{ required: true, message: '请选择运行状态', trigger: 'blur' }" :rules="{ required: true, message: '请选择运行状态', trigger: 'blur' }"
> >
<!-- 0运行1检修2停运3调试4退运 --> <!-- 0运行1检修2停运3调试4退运 -->
<el-select <el-select
clearable
filterable filterable
v-model="lineItem.runStatus" v-model="lineItem.runStatus"
placeholder="请选择运行状态" placeholder="请选择运行状态"
@@ -910,6 +1011,35 @@
<el-option label="退运" :value="4" /> <el-option label="退运" :value="4" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item
class="form-item"
label="日志等级:"
:prop="'lineInfoList[' + lIndex + '].lineLogLevel'"
:rules="{ required: true, message: '请选择日志等级', trigger: 'change' }"
>
<!-- 0运行1检修2停运3调试4退运 -->
<el-select
clearable
filterable
v-model="lineItem.lineLogLevel"
placeholder="请选择日志等级"
:disabled="
!(
(nodeLevel == 4 && pageStatus == 3) ||
((nodeLevel == 3 || (nodeLevel == 2 && pageStatus == 2)) &&
pageStatus == 2)
)
"
>
<el-option
v-for="value in logList"
:key="value.value"
:label="value.label"
:value="value.value"
></el-option>
</el-select>
</el-form-item>
</div> </div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
@@ -966,8 +1096,8 @@
<Loading /> <Loading />
</el-icon> </el-icon>
<p style="margin-top: 15px; font-size: 16px">正在推送台账信息,请稍候...</p> <p style="margin-top: 15px; font-size: 16px">正在推送台账信息,请稍候...</p>
<p style="margin-top: 10px; color: #999">预计需要30秒左右</p> <!-- <p style="margin-top: 10px; color: #999">预计需要30秒左右</p>
<p style="margin-top: 10px; color: #999">已等待: {{ countdown }}秒</p> <p style="margin-top: 10px; color: #999">已等待: {{ countdown }}秒</p> -->
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
@@ -1004,7 +1134,7 @@ import MacAddressInput from '@/components/form/mac/MacAddressInput.vue'
import { auditEngineering } from '@/api/cs-device-boot/edData' import { auditEngineering } from '@/api/cs-device-boot/edData'
import { convertToObject } from 'typescript' import { convertToObject } from 'typescript'
import { Loading } from '@element-plus/icons-vue' import { Loading } from '@element-plus/icons-vue'
import { getListByIds } from '@/api/cs-harmonic-boot/recruitment' import { getList } from '@/api/cs-harmonic-boot/recruitment'
import { getDicDataByTypeCode } from '@/api/system-boot/csDictData' import { getDicDataByTypeCode } from '@/api/system-boot/csDictData'
defineOptions({ defineOptions({
@@ -1034,7 +1164,8 @@ const devId: any = ref('0')
const busBarId: any = ref('0') const busBarId: any = ref('0')
const lineId: any = ref('0') const lineId: any = ref('0')
const userList: any = ref([]) const userList: any = ref([])
const monitorObjList: any = ref([]) const monitorObjList: any = dictData.getBasicData('M_Obj_Types')
const linePosition: any = dictData.getBasicData('Line_Position')
const currentGdName: any = ref('') const currentGdName: any = ref('')
const affiliatiedFrontArr: any = ref([]) const affiliatiedFrontArr: any = ref([])
@@ -1046,23 +1177,21 @@ const treeClickCount = ref(0)
const areaTree: any = tree const areaTree: any = tree
const formData = ref({ const formData = ref({
lineInfoList: [] as LineInfo[], lineInfoList: [] as LineInfo[],
projectInfoList:[] as ProjectInfo[], projectInfoList: [] as ProjectInfo[],
deviceInfoList :[] as DeviceInfo[], deviceInfoList: [] as DeviceInfo[],
engineeringParam: { engineeringParam: {
city: '', city: '',
description: '', description: '',
name: '', name: '',
province: '' province: ''
} }
}) })
const project = ref([ const project = ref([
{ name: '治理设备', value: '治理设备' }, { name: '治理设备', value: '治理设备' },
{ name: '便携式设备', value: '便携式设备' }, { name: '便携式设备', value: '便携式设备' },
{ name: '在线设备', value: '在线设备' } { name: '监测设备', value: '监测设备' }
]) ])
const wiringTypeArr = ref([ const wiringTypeArr = ref([
{ name: '星型接线', value: 0 }, { name: '星型接线', value: 0 },
@@ -1085,6 +1214,24 @@ const lineSpaceArr = ref([
{ name: '5分钟', value: 5 }, { name: '5分钟', value: 5 },
{ name: '10分钟', value: 10 } { name: '10分钟', value: 10 }
]) ])
const logList = ref([
{
value: 'DEBUG',
label: 'DEBUG'
},
{
value: 'NORMAL',
label: 'NORMAL'
},
{
value: 'WARN',
label: 'WARN'
},
{
value: 'ERROR',
label: 'ERROR'
}
])
//工程 //工程
// const engineeringParam = ref({ // const engineeringParam = ref({
// city: '', // city: '',
@@ -1105,6 +1252,7 @@ interface DeviceInfo {
devModel: string devModel: string
devType: string devType: string
devAccessMethod: string devAccessMethod: string
devLogLevel: string
mac: string mac: string
ndid: string ndid: string
nodeId: string nodeId: string
@@ -1127,7 +1275,9 @@ interface LineInfo {
devMac: string devMac: string
monitorUser: string monitorUser: string
monitorObj: string monitorObj: string
position: string
govern: string | number govern: string | number
lineLogLevel: string
runStatus: string | number runStatus: string | number
basicCapacity: number basicCapacity: number
shortCircuitCapacity: number shortCircuitCapacity: number
@@ -1289,7 +1439,7 @@ const onAdd = async () => {
if (timer.value) clearInterval(timer.value) if (timer.value) clearInterval(timer.value)
timer.value = window.setInterval(() => { timer.value = window.setInterval(() => {
countdown.value++ countdown.value++
if (countdown.value >= 30) { if (countdown.value >= 5) {
clearInterval(timer.value!) clearInterval(timer.value!)
timer.value = null timer.value = null
} }
@@ -1317,7 +1467,7 @@ const onAdd = async () => {
// 如果data不是"暂无需要推送的数据",则继续执行 // 如果data不是"暂无需要推送的数据",则继续执行
if (pushLogResponse.data === '成功') { if (pushLogResponse.data === '成功') {
// 等待30秒 // 等待30秒
await new Promise(resolve => setTimeout(resolve, 30000)) await new Promise(resolve => setTimeout(resolve, 5000))
// 30秒后调用查询推送结果接口 // 30秒后调用查询推送结果接口
const result = await queryPushResult() const result = await queryPushResult()
@@ -1480,6 +1630,7 @@ const add = () => {
devModel: '', devModel: '',
devType: '', devType: '',
devAccessMethod: 'CLD', devAccessMethod: 'CLD',
devLogLevel: 'WARN',
mac: '', mac: '',
ndid: '', ndid: '',
nodeId: '', nodeId: '',
@@ -1506,7 +1657,9 @@ const add = () => {
monitorUser: '', monitorUser: '',
devMac: '', devMac: '',
monitorObj: '', monitorObj: '',
position: '',
govern: 0, govern: 0,
lineLogLevel: 'WARN',
runStatus: 0, runStatus: 0,
basicCapacity: 0, basicCapacity: 0,
shortCircuitCapacity: 0, shortCircuitCapacity: 0,
@@ -1619,8 +1772,9 @@ const updateEquipmentFunc = (id: any) => {
id: id, // 设备ID用于修改 id: id, // 设备ID用于修改
name: currentDevice.name, name: currentDevice.name,
devModel: currentDevice.devModel, devModel: currentDevice.devModel,
devType: currentDevice.devType, devType: currentDevice.devType,
devAccessMethod: currentDevice.devAccessMethod, devAccessMethod: currentDevice.devAccessMethod,
devLogLevel: currentDevice.devLogLevel,
mac: currentDevice.mac, mac: currentDevice.mac,
nodeId: currentDevice.nodeId, nodeId: currentDevice.nodeId,
cntractNo: currentDevice.cntractNo, cntractNo: currentDevice.cntractNo,
@@ -1682,8 +1836,10 @@ const updateLineFunc = (id: any) => {
ct2Ratio: currentLine.ct2Ratio || 1, ct2Ratio: currentLine.ct2Ratio || 1,
monitorUser: currentLine.monitorUser || '', monitorUser: currentLine.monitorUser || '',
monitorObj: currentLine.monitorObj || '', monitorObj: currentLine.monitorObj || '',
govern: currentLine.govern , position: currentLine.position || '',
runStatus: currentLine.runStatus , govern: currentLine.govern,
lineLogLevel: currentLine.lineLogLevel,
runStatus: currentLine.runStatus,
basicCapacity: currentLine.basicCapacity || 0, basicCapacity: currentLine.basicCapacity || 0,
shortCircuitCapacity: currentLine.shortCircuitCapacity || 0, shortCircuitCapacity: currentLine.shortCircuitCapacity || 0,
devCapacity: currentLine.devCapacity || 0, devCapacity: currentLine.devCapacity || 0,
@@ -1848,6 +2004,7 @@ const next = async () => {
devModel: '', devModel: '',
devType: '', devType: '',
devAccessMethod: 'CLD', devAccessMethod: 'CLD',
devLogLevel: 'WARN',
mac: '', mac: '',
ndid: '', ndid: '',
nodeId: '', nodeId: '',
@@ -1878,7 +2035,9 @@ const next = async () => {
monitorUser: '', monitorUser: '',
devMac: '', devMac: '',
monitorObj: '', monitorObj: '',
position: '',
govern: 0, govern: 0,
lineLogLevel:'WARN',
runStatus: 0, runStatus: 0,
basicCapacity: 0, basicCapacity: 0,
shortCircuitCapacity: 0, shortCircuitCapacity: 0,
@@ -1900,7 +2059,6 @@ const next = async () => {
} }
} }
}) })
} }
// 撤销 // 撤销
@@ -1925,21 +2083,21 @@ const black = () => {
const onsubmit = async () => { const onsubmit = async () => {
await mainForm.value.validate((valid: any) => { await mainForm.value.validate((valid: any) => {
if (valid) { if (valid) {
if (pageStatus.value == 2) { if (pageStatus.value == 2) {
// 新增 // 新增
// 检查是否是多层级新增还是单层级新增 // 检查是否是多层级新增还是单层级新增
if ( if (
tempAllLevelData.value.engineering !== null || tempAllLevelData.value.engineering !== null ||
tempAllLevelData.value.projects.length > 0 || tempAllLevelData.value.projects.length > 0 ||
tempAllLevelData.value.devices.length > 0 || tempAllLevelData.value.devices.length > 0 ||
tempAllLevelData.value.lines.length > 0 tempAllLevelData.value.lines.length > 0
) { ) {
// 多层级新增,一次性提交所有数据 // 多层级新增,一次性提交所有数据
submitAllLevelData() submitAllLevelData()
} else { } else {
// 单层级新增,使用原有的提交方式 // 单层级新增,使用原有的提交方式
submitData() submitData()
} }
} else if (pageStatus.value == 3) { } else if (pageStatus.value == 3) {
// 修改 // 修改
switch (nodeLevel.value) { switch (nodeLevel.value) {
@@ -1958,7 +2116,6 @@ const onsubmit = async () => {
} }
} }
} }
}) })
} }
@@ -2003,7 +2160,9 @@ const submitAllLevelData = async () => {
case 2: // 工程 + 项目 + 设备 case 2: // 工程 + 项目 + 设备
// 工程信息 // 工程信息
const engineeringData2 = tempAllLevelData.value.engineering || { ...formData.value.engineeringParam } const engineeringData2 = tempAllLevelData.value.engineering || {
...formData.value.engineeringParam
}
// 项目信息 // 项目信息
const projectData2 = const projectData2 =
tempAllLevelData.value.projects.length > 0 tempAllLevelData.value.projects.length > 0
@@ -2059,7 +2218,9 @@ const submitAllLevelData = async () => {
case 3: // 工程 + 项目 + 设备 + 监测点 case 3: // 工程 + 项目 + 设备 + 监测点
case 4: case 4:
// 工程信息 // 工程信息
const engineeringData3 = tempAllLevelData.value.engineering || { ...formData.value.engineeringParam } const engineeringData3 = tempAllLevelData.value.engineering || {
...formData.value.engineeringParam
}
// 项目信息 // 项目信息
const projectData3 = const projectData3 =
@@ -2255,10 +2416,8 @@ const submitAllLevelData = async () => {
} }
}, 100) }, 100)
}) })
} }
}) })
} }
/** /**
* 重置所有表单 * 重置所有表单
@@ -2283,6 +2442,8 @@ const resetAllForms = () => {
device.devModel = '' device.devModel = ''
device.devType = '' device.devType = ''
device.devAccessMethod = 'CLD' device.devAccessMethod = 'CLD'
device.devLogLevel = 'WARN'
device.mac = '' device.mac = ''
device.nodeId = '' device.nodeId = ''
device.cntractNo = '' device.cntractNo = ''
@@ -2302,7 +2463,9 @@ const resetAllForms = () => {
line.volGrade = '' line.volGrade = ''
line.monitorUser = '' line.monitorUser = ''
line.monitorObj = '' line.monitorObj = ''
line.position = ''
line.govern = 0 line.govern = 0
line.lineLogLevel = 'WARN'
line.runStatus = 0 line.runStatus = 0
line.basicCapacity = 0 line.basicCapacity = 0
line.shortCircuitCapacity = 0 line.shortCircuitCapacity = 0
@@ -2401,6 +2564,7 @@ const submitData = () => {
devModel: currentDevice.devModel, devModel: currentDevice.devModel,
devType: currentDevice.devType, devType: currentDevice.devType,
devAccessMethod: currentDevice.devAccessMethod, devAccessMethod: currentDevice.devAccessMethod,
devLogLevel: currentDevice.devLogLevel,
mac: currentDevice.mac, mac: currentDevice.mac,
nodeId: currentDevice.nodeId, nodeId: currentDevice.nodeId,
cntractNo: currentDevice.cntractNo, cntractNo: currentDevice.cntractNo,
@@ -2469,7 +2633,9 @@ const submitData = () => {
ct2Ratio: currentLine.ct2Ratio, ct2Ratio: currentLine.ct2Ratio,
monitorUser: currentLine.monitorUser, monitorUser: currentLine.monitorUser,
monitorObj: currentLine.monitorObj, monitorObj: currentLine.monitorObj,
position: currentLine.position,
govern: currentLine.govern, govern: currentLine.govern,
lineLogLevel: currentLine.lineLogLevel,
runStatus: currentLine.runStatus, runStatus: currentLine.runStatus,
basicCapacity: currentLine.basicCapacity, basicCapacity: currentLine.basicCapacity,
shortCircuitCapacity: currentLine.shortCircuitCapacity, shortCircuitCapacity: currentLine.shortCircuitCapacity,
@@ -2584,6 +2750,7 @@ const handleBusBarTabsEdit = (targetName: any, action: any) => {
devModel: '', devModel: '',
devType: '', devType: '',
devAccessMethod: 'CLD', devAccessMethod: 'CLD',
devLogLevel: 'WARN',
mac: '', mac: '',
ndid: '', ndid: '',
nodeId: '', nodeId: '',
@@ -2620,7 +2787,9 @@ const handleBusBarTabsEdit = (targetName: any, action: any) => {
} else { } else {
// 如果是新增模式下删除未保存的设备 // 如果是新增模式下删除未保存的设备
formData.value.deviceInfoList.splice(busBarIndex.value, 1) formData.value.deviceInfoList.splice(busBarIndex.value, 1)
busBarIndex.value = formData.value.deviceInfoList.length ? (formData.value.deviceInfoList.length - 1).toString() : '0' busBarIndex.value = formData.value.deviceInfoList.length
? (formData.value.deviceInfoList.length - 1).toString()
: '0'
lineIndex.value = '0' lineIndex.value = '0'
ElMessage({ ElMessage({
type: 'success', type: 'success',
@@ -2656,7 +2825,9 @@ const handleLineTabsEdit = (targetName: any, action: any) => {
devMac: '', devMac: '',
monitorUser: '', monitorUser: '',
monitorObj: '', monitorObj: '',
position: '',
govern: 0, govern: 0,
lineLogLevel: 'WARN',
runStatus: 0, runStatus: 0,
basicCapacity: 0, basicCapacity: 0,
shortCircuitCapacity: 0, shortCircuitCapacity: 0,
@@ -2682,14 +2853,18 @@ const handleLineTabsEdit = (targetName: any, action: any) => {
// 从列表中移除 // 从列表中移除
formData.value.lineInfoList.splice(lineIndex.value, 1) formData.value.lineInfoList.splice(lineIndex.value, 1)
// 重新设置当前选中的tab // 重新设置当前选中的tab
lineIndex.value = formData.value.lineInfoList.length ? (formData.value.lineInfoList.length - 1).toString() : '0' lineIndex.value = formData.value.lineInfoList.length
? (formData.value.lineInfoList.length - 1).toString()
: '0'
pageStatus.value = 1 pageStatus.value = 1
treedata() treedata()
}) })
} else { } else {
// 如果是新增模式下删除未保存的监测点 // 如果是新增模式下删除未保存的监测点
formData.value.lineInfoList.splice(lineIndex.value, 1) formData.value.lineInfoList.splice(lineIndex.value, 1)
lineIndex.value = formData.value.lineInfoList.length ? (formData.value.lineInfoList.length - 1).toString() : '0' lineIndex.value = formData.value.lineInfoList.length
? (formData.value.lineInfoList.length - 1).toString()
: '0'
ElMessage({ ElMessage({
type: 'success', type: 'success',
message: '删除成功' message: '删除成功'
@@ -2722,7 +2897,7 @@ const treedata = (selectedNodeId?: string) => {
} }
titleList.value = [] titleList.value = []
titleList.value.unshift('在线设备') titleList.value.unshift('监测设备')
} }
/** /**
* 重置初始状态 * 重置初始状态
@@ -2744,7 +2919,7 @@ const reaseStatus = () => {
currentGdName.value = '' currentGdName.value = ''
} }
const area = () => { const area = async () => {
nodeAllList() nodeAllList()
.then(res => { .then(res => {
affiliatiedFrontArr.value = res.data affiliatiedFrontArr.value = res.data
@@ -2771,11 +2946,11 @@ const area = () => {
console.error('查询过程中出现错误:', error) console.error('查询过程中出现错误:', error)
}) })
getListByIds().then(res => { getList({
userList.value = res.data pageNum: 1,
}) pageSize: 2000
getDicDataByTypeCode({ dictTypeCode: 'M_Obj_Types' }).then(res => { }).then(res => {
monitorObjList.value = res.data userList.value = res.data.records
}) })
} }
@@ -2838,7 +3013,7 @@ area()
.el-form-item { .el-form-item {
width: 30%; width: 30%;
margin-bottom: 15px; margin-bottom: 15px !important;
.el-select { .el-select {
width: 100%; width: 100%;

View File

@@ -1,176 +1,176 @@
<!-- 补召日志 --> <!-- 补召日志 -->
<template> <template>
<el-dialog modal-class="analysisList" v-model.trim="dialogVisible" title="补召日志" width="70%" draggable <el-dialog modal-class="analysisList" v-model.trim="dialogVisible" title="补召日志" width="70%" draggable
@closed="close"> @closed="close">
<TableHeader date-picker :showReset="false"> <TableHeader date-picker :showReset="false">
<template #operation> <template #operation>
<el-button type="primary" icon="el-icon-Connection" @click="handleImport"> <el-button type="primary" icon="el-icon-Connection" @click="handleImport">
离线补召 离线补召
</el-button> </el-button>
<el-button type="primary" icon="el-icon-Monitor" @click="handleaddDevice"> <el-button type="primary" icon="el-icon-Monitor" @click="handleaddDevice">
在线补召 在线补召
</el-button> </el-button>
</template> </template>
</TableHeader> </TableHeader>
<Table ref="tableRef" /> <Table ref="tableRef" :height="`calc(45vh - 50px)`"/>
</el-dialog> </el-dialog>
<popup ref="detailRef"></popup> <popup ref="detailRef"></popup>
<!-- 离线数据导入组件 --> <!-- 离线数据导入组件 -->
<!-- <offLineDataImport ref="offLineDataImportRef"></offLineDataImport> --> <!-- <offLineDataImport ref="offLineDataImportRef"></offLineDataImport> -->
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, onMounted, provide, onBeforeUnmount } from 'vue' import { ref, onMounted, provide, onBeforeUnmount } from 'vue'
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue' import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue' import TableHeader from '@/components/table/header/index.vue'
import offLineDataImport from '../offLineDataImport/index.vue' import offLineDataImport from '../offLineDataImport/index.vue'
import popup from './popup.vue' import popup from './popup.vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
defineOptions({ defineOptions({
name: 'offLineDataImport' name: 'offLineDataImport'
}) })
const emit = defineEmits(['back']) const emit = defineEmits(['back'])
const dialogVisible = ref(false) const dialogVisible = ref(false)
const height = ref(0) const height = ref(0)
height.value = window.innerHeight < 1080 ? 230 : 450 height.value = window.innerHeight < 1080 ? 230 : 450
const detailRef: any = ref() const detailRef: any = ref()
const lineId = ref('') const lineId = ref('')
const deviceId = ref('') const deviceId = ref('')
const deviceData = ref({}) const deviceData = ref({})
const { push, options, currentRoute } = useRouter() const { push, options, currentRoute } = useRouter()
const tableStore: any = new TableStore({ const tableStore: any = new TableStore({
url: '/cs-device-boot/portableOfflLog/queryMainLogPage', url: '/cs-device-boot/portableOfflLog/queryMainLogPage',
publicHeight: 420, publicHeight: 420,
method: 'POST', method: 'POST',
column: [ column: [
// { width: '60', type: 'checkbox', fixed: 'left' }, // { width: '60', type: 'checkbox', fixed: 'left' },
{ {
title: '序号', width: 80, formatter: (row: any) => { title: '序号', width: 80, formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1 return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
} }
}, },
{ {
field: 'projectName', field: 'projectName',
title: '工程名称', title: '工程名称',
minWidth: 170, minWidth: 170,
formatter: row => { formatter: row => {
return row.cellValue ? row.cellValue : '/' return row.cellValue ? row.cellValue : '/'
} }
}, },
{ field: 'successCount', title: '成功解析数', minWidth: 150 }, { field: 'successCount', title: '成功解析数', minWidth: 150 },
{ field: 'startTime', title: '导入开始时间', minWidth: 170, sortable: true }, { field: 'startTime', title: '导入开始时间', minWidth: 170, sortable: true },
{ field: 'endTime', title: '导入结束时间', minWidth: 170 , sortable: true}, { field: 'endTime', title: '导入结束时间', minWidth: 170 , sortable: true},
{ {
title: '解析状态', title: '解析状态',
field: 'status', field: 'status',
width: 100, width: 100,
render: 'tag', render: 'tag',
custom: { custom: {
0: 'warning', 0: 'warning',
1: 'success', 1: 'success',
2: 'danger', 2: 'danger',
3: 'primary' 3: 'primary'
}, },
replaceValue: { replaceValue: {
0: '未解析', 0: '未解析',
1: '解析成功', 1: '解析成功',
2: '解析失败', 2: '解析失败',
3: '文件不存在' 3: '文件不存在'
} }
// formatter: row => { // formatter: row => {
// return row.cellValue == 1 ? '未注册' : row.cellValue == 2 ? '注册' : '接入' // return row.cellValue == 1 ? '未注册' : row.cellValue == 2 ? '注册' : '接入'
// }, // },
}, },
{ {
title: '操作', title: '操作', fixed: 'right',
width: '100', width: '100',
render: 'buttons', render: 'buttons',
buttons: [ buttons: [
{ {
name: 'edit', name: 'edit',
title: '详情', title: '详情',
type: 'primary', type: 'primary',
icon: 'el-icon-EditPen', icon: 'el-icon-EditPen',
render: 'basicButton', render: 'basicButton',
click: row => { click: row => {
// console.log(row.portableOfflLogList) // console.log(row.portableOfflLogList)
detailRef.value.open(row.portableOfflLogList) detailRef.value.open(row.portableOfflLogList)
} }
} }
] ]
} }
], ],
beforeSearchFun: () => { beforeSearchFun: () => {
// tableStore.table.params.devId = tableParams.value.devId // tableStore.table.params.devId = tableParams.value.devId
// tableStore.table.params.lineId = tableParams.value.lineId // tableStore.table.params.lineId = tableParams.value.lineId
// tableStore.table.params.list = tableParams.value.list // tableStore.table.params.list = tableParams.value.list
// tableStore.table.params.type = 3 // tableStore.table.params.type = 3
}, },
loadCallback: () => { loadCallback: () => {
// tableStore.table.data=[] // tableStore.table.data=[]
tableStore.table.height = 400 tableStore.table.height = 400
// console.log(tableStore.table.publicHeight, 'tableStore.table.data') // console.log(tableStore.table.publicHeight, 'tableStore.table.data')
} }
}) })
provide('tableStore', tableStore) provide('tableStore', tableStore)
//返回 //返回
const handleBack = () => { const handleBack = () => {
emit('back') emit('back')
} }
const open = (row: any) => { const open = (row: any) => {
lineId.value = row.lineId lineId.value = row.lineId
deviceData.value = row.deviceData deviceData.value = row.deviceData
deviceId.value = row.deviceId deviceId.value = row.deviceId
dialogVisible.value = true dialogVisible.value = true
setTimeout(() => { setTimeout(() => {
tableStore.index() tableStore.index()
}, 10) }, 10)
} }
const close = () => { const close = () => {
dialogVisible.value = false dialogVisible.value = false
} }
const updateViewportHeight = async () => { const updateViewportHeight = async () => {
// height.value = window.innerHeight; // height.value = window.innerHeight;
height.value = window.innerHeight < 1080 ? 230 : 450 height.value = window.innerHeight < 1080 ? 230 : 450
// tableStore.table.publicHeight = height.value // tableStore.table.publicHeight = height.value
// await tableStore.index() // await tableStore.index()
} }
//设备补召 //设备补召
const handleaddDevice = () => { const handleaddDevice = () => {
push({ push({
path: '/supplementaryRecruitment', path: '/supplementaryRecruitment',
query: { query: {
activeName: '0', activeName: '0',
id: lineId.value, id: lineId.value,
ndid: deviceData.value?.ndid, ndid: deviceData.value?.ndid,
} }
}) })
} }
const offLineDataImportRef = ref() const offLineDataImportRef = ref()
const handleImport = () => { const handleImport = () => {
//设备devId&监测点lineId带入组件 //设备devId&监测点lineId带入组件
// offLineDataImportRef.value && offLineDataImportRef.value.open(deviceId.value, lineId.value) // offLineDataImportRef.value && offLineDataImportRef.value.open(deviceId.value, lineId.value)
push({ push({
path: '/supplementaryRecruitment', path: '/supplementaryRecruitment',
query: { query: {
activeName: '1', activeName: '1',
lineId: lineId.value, lineId: lineId.value,
deviceId: deviceId.value, deviceId: deviceId.value,
} }
}) })
} }
onMounted(() => { onMounted(() => {
updateViewportHeight() // 初始化视口高度 updateViewportHeight() // 初始化视口高度
window.addEventListener('resize', updateViewportHeight) // 监听窗口大小变化 window.addEventListener('resize', updateViewportHeight) // 监听窗口大小变化
}) })
onBeforeUnmount(() => { onBeforeUnmount(() => {
window.removeEventListener('resize', updateViewportHeight) // 移除监听 window.removeEventListener('resize', updateViewportHeight) // 移除监听
}) })
defineExpose({ open }) defineExpose({ open })
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>

View File

@@ -1,123 +1,123 @@
<!-- 解析列表 --> <!-- 解析列表 -->
<template> <template>
<el-dialog v-model.trim="dialogVisible" title="详情" width="70%" draggable @closed="close"> <el-dialog v-model.trim="dialogVisible" title="详情" width="70%" draggable @closed="close">
<div :style="tableHeight"> <div :style="tableHeight">
<vxe-table border auto-resize height="auto" :data="tableData" v-bind="defaultAttribute"> <vxe-table border auto-resize height="auto" :data="tableData" v-bind="defaultAttribute">
<vxe-column field="name" align="center" title="文件名称"></vxe-column> <vxe-column field="name" 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="allCount" align="center" title="数据总数(条)" width="120"></vxe-column> <vxe-column field="allCount" align="center" title="数据总数(条)" width="120"></vxe-column>
<vxe-column field="realCount" align="center" title="已入库总数(条)" width="120"></vxe-column> <vxe-column field="realCount" align="center" title="已入库总数(条)" width="120"></vxe-column>
<vxe-column field="state" align="center" title="解析状态" width="100"> <vxe-column field="state" align="center" title="解析状态" width="100">
<template v-slot:default="scoped"> <template v-slot:default="scoped">
<el-tag type="warning" v-if="scoped.row.state == 0">未解析</el-tag> <el-tag type="warning" v-if="scoped.row.state == 0">未解析</el-tag>
<el-tag type="success" v-if="scoped.row.state == 1">解析成功</el-tag> <el-tag type="success" v-if="scoped.row.state == 1">解析成功</el-tag>
<el-tag type="danger" v-if="scoped.row.state == 2">解析失败</el-tag> <el-tag type="danger" v-if="scoped.row.state == 2">解析失败</el-tag>
<el-tag type="primary" v-if="scoped.row.state == 3">文件不存在</el-tag> <el-tag type="primary" v-if="scoped.row.state == 3">文件不存在</el-tag>
</template> </template>
</vxe-column> </vxe-column>
</vxe-table> </vxe-table>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, onMounted, onBeforeUnmount } from 'vue' import { ref, onMounted, onBeforeUnmount } 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 { mainHeight } from '@/utils/layout' import { mainHeight } from '@/utils/layout'
const emit = defineEmits(['back']) const emit = defineEmits(['back'])
const dialogVisible = ref(false) const dialogVisible = ref(false)
const tableHeight = mainHeight(440) const tableHeight = mainHeight(440)
const height = ref(0) const height = ref(0)
height.value = window.innerHeight < 1080 ? 230 : 450 height.value = window.innerHeight < 1080 ? 230 : 450
const tableStore: any = new TableStore({ const tableStore: any = new TableStore({
url: '', url: '',
// publicHeight: height.value, // publicHeight: height.value,
showPage: false, showPage: false,
column: [ column: [
{ width: '60', type: 'checkbox', fixed: 'left' }, { width: '60', type: 'checkbox', fixed: 'left' },
{ {
title: '序号', width: 80, formatter: (row: any) => { title: '序号', width: 80, formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1 return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
} }
}, },
{ field: 'name', title: '文件名称', minWidth: 170 }, { field: 'name', title: '文件名称', minWidth: 170 },
{ field: 'createTime', title: '导入时间', minWidth: 170 , sortable: true}, { field: 'createTime', title: '导入时间', minWidth: 170 , sortable: true},
{ field: 'allCount', title: '数据总数(条)', minWidth: 170 , sortable: true}, { field: 'allCount', title: '数据总数(条)', minWidth: 170 , sortable: true},
{ field: 'realCount', title: '已入库总数(条)', minWidth: 170, sortable: true }, { field: 'realCount', title: '已入库总数(条)', minWidth: 170, sortable: true },
{ {
title: '解析状态', title: '解析状态',
field: 'state', field: 'state',
width: 100, width: 100,
render: 'tag', render: 'tag',
custom: { custom: {
0: 'warning', 0: 'warning',
1: 'success', 1: 'success',
2: 'danger', 2: 'danger',
3: 'primary' 3: 'primary'
}, },
replaceValue: { replaceValue: {
0: '未解析', 0: '未解析',
1: '解析成功', 1: '解析成功',
2: '解析失败', 2: '解析失败',
3: '文件不存在' 3: '文件不存在'
} }
}, },
{ {
title: '操作', title: '操作', fixed: 'right',
width: '180', width: '180',
render: 'buttons', render: 'buttons',
buttons: [ buttons: [
{ {
name: 'edit', name: 'edit',
title: '详情', title: '详情',
type: 'primary', type: 'primary',
icon: 'el-icon-EditPen', icon: 'el-icon-EditPen',
render: 'basicButton', render: 'basicButton',
click: row => { click: row => {
// console.log(row.portableOfflLogList) // console.log(row.portableOfflLogList)
} }
} }
] ]
} }
], ],
loadCallback: () => { loadCallback: () => {
tableStore.table.data = [] tableStore.table.data = []
} }
}) })
//返回 //返回
const handleBack = () => { const handleBack = () => {
emit('back') emit('back')
} }
const tableData: any = ref() const tableData: any = ref()
const open = (val: any) => { const open = (val: any) => {
dialogVisible.value = true dialogVisible.value = true
tableData.value = val tableData.value = val
setTimeout(() => { setTimeout(() => {
tableStore.index() tableStore.index()
}, 10) }, 10)
} }
const close = () => { const close = () => {
dialogVisible.value = false dialogVisible.value = false
} }
const updateViewportHeight = async () => { const updateViewportHeight = async () => {
height.value = window.innerHeight < 1080 ? 230 : 450 height.value = window.innerHeight < 1080 ? 230 : 450
tableStore.table.publicHeight = height.value tableStore.table.publicHeight = height.value
} }
onMounted(() => { onMounted(() => {
updateViewportHeight() // 初始化视口高度 updateViewportHeight() // 初始化视口高度
window.addEventListener('resize', updateViewportHeight) // 监听窗口大小变化 window.addEventListener('resize', updateViewportHeight) // 监听窗口大小变化
}) })
onBeforeUnmount(() => { onBeforeUnmount(() => {
window.removeEventListener('resize', updateViewportHeight) // 移除监听 window.removeEventListener('resize', updateViewportHeight) // 移除监听
}) })
defineExpose({ open }) defineExpose({ open })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep .el-dialog__body { ::v-deep .el-dialog__body {
overflow-y: none !important; overflow-y: none !important;
max-height: 70vh !important; max-height: 70vh !important;
} }
</style> </style>

View File

@@ -50,10 +50,18 @@
</el-descriptions-item> --> </el-descriptions-item> -->
<el-descriptions-item label="PT变比" width="160"> <el-descriptions-item label="PT变比" width="160">
{{ devData.ptRatio || '/' }} {{
devData.ptRatio == null
? '/'
: devData.ptRatio + (devData.pt2Ratio == null ? '' : ':' + devData.pt2Ratio)
}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="CT变比" width="160"> <el-descriptions-item label="CT变比" width="160">
{{ devData.ctRatio || '/' }} {{
devData.ctRatio == null
? '/'
: devData.ctRatio + (devData.ct2Ratio == null ? '' : ':' + devData.ct2Ratio)
}}
</el-descriptions-item> </el-descriptions-item>
<!-- <el-descriptions-item label="名称"> <!-- <el-descriptions-item label="名称">
@@ -83,6 +91,7 @@
:name="item.id" :name="item.id"
v-for="(item, index) in deviceData.dataSetList" v-for="(item, index) in deviceData.dataSetList"
:key="index" :key="index"
:disabled="tableLoading"
> >
<template #label> <template #label>
<span class="custom-tabs-label"> <span class="custom-tabs-label">
@@ -700,7 +709,7 @@ const handleTrend = async () => {
// } // }
}) })
} else { } else {
ElMessage.success('装置应答失败') ElMessage.warning('装置应答失败')
} }
}) })
.catch(e => { .catch(e => {
@@ -748,11 +757,13 @@ const handleHarmonicSpectrum = async () => {
//返回 //返回
const handleReturn = async () => { const handleReturn = async () => {
if (realDataTimer.value) { if (realDataTimer.value) {
clearInterval(realDataTimer.value) window.clearInterval(realDataTimer.value)
} }
if (trendTimer.value) { if (trendTimer.value) {
clearInterval(trendTimer.value) window.clearInterval(trendTimer.value)
} }
realTimeFlag.value = true realTimeFlag.value = true
sonTab.value = null sonTab.value = null
activeTrendName.value = 0 activeTrendName.value = 0
@@ -981,10 +992,10 @@ const getRealDataMqttMsg = async () => {
}) })
}, 30000) }, 30000)
mqttRef.value.on('message', (topic: any, message: any) => { mqttRef.value.on('message', (topic: any, message: any) => {
console.log( // console.log(
'实时数据&实时趋势---mqtt接收到消息', // '实时数据&实时趋势---mqtt接收到消息',
JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message)))) // JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message))))
) // )
let obj = JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message)))) let obj = JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message))))
if (lineId.value != obj.lineId || adminInfo.userIndex != obj.userId) return if (lineId.value != obj.lineId || adminInfo.userIndex != obj.userId) return
@@ -1152,10 +1163,10 @@ const mqttMessage = ref<any>({})
const handleClick = async (tab?: any) => { const handleClick = async (tab?: any) => {
tableLoading.value = true tableLoading.value = true
if (realDataTimer.value) { if (realDataTimer.value) {
clearInterval(realDataTimer.value) window.clearInterval(realDataTimer.value)
} }
if (trendTimer.value) { if (trendTimer.value) {
clearInterval(trendTimer.value) window.clearInterval(trendTimer.value)
} }
sonTab.value = null sonTab.value = null
activeTrendName.value = 0 activeTrendName.value = 0

View File

@@ -375,12 +375,12 @@ const changeDataType = () => {
let flag = dataType.value.includes(0) || dataType.value.includes(1) let flag = dataType.value.includes(0) || dataType.value.includes(1)
if (flag) { if (flag) {
let data1 = dataType.value.includes(0) let data1 = dataType.value.includes(0)
? list.value[activeTab.value].loadList.map(k => (k.data == 3.14159 ? 0 : k.data)) ? list.value[activeTab.value]?.loadList.map(k => (k.data == 3.14159 ? 0 : k.data))
: [0] : [0]
let data2 = dataType.value.includes(1) let data2 = dataType.value.includes(1)
? list.value[activeTab.value].modOutList.map(k => (k.data == 3.14159 ? 0 : k.data)) ? list.value[activeTab.value]?.modOutList.map(k => (k.data == 3.14159 ? 0 : k.data))
: [0] : [0]
let [modOuMin, modOuMax] = yMethod([...data1, ...data2]) let [modOuMin, modOuMax] = yMethod([...data1||[0], ...data2||[0]])
console.log("🚀 ~ changeDataType ~ modOuMin:", modOuMin,modOuMax) console.log("🚀 ~ changeDataType ~ modOuMin:", modOuMin,modOuMax)
echartsData.value.yAxis[0] = { echartsData.value.yAxis[0] = {

View File

@@ -16,14 +16,19 @@
<el-button type="primary" :icon="Setting" @click="handleUpDevice">补召</el-button> <el-button type="primary" :icon="Setting" @click="handleUpDevice">补召</el-button>
<el-button :icon="Back" @click="go(-1)">返回</el-button> <el-button :icon="Back" @click="go(-1)">返回</el-button>
</template> </template>
</TableHeader> </TableHeader>
<!-- 设备补召 --> <!-- 设备补召 -->
<div class=" current_device" v-loading="loading"> <div class="current_device" v-loading="loading">
<div class="current_body" ref="tbodyRef"> <div class="current_body" ref="tbodyRef">
<vxe-table border ref="tableRef" :data="dirList" align="center" height="auto" <vxe-table
:style="{ height: tableHeight }" @radio-change="radioChangeEvent"> border
ref="tableRef"
:data="dirList"
align="center"
height="auto"
:style="{ height: tableHeight }"
@radio-change="radioChangeEvent"
>
<vxe-column type="radio" width="60"> <vxe-column type="radio" width="60">
<template #header> <template #header>
<vxe-button mode="text" @click="clearRadioRowEvent" :disabled="!selectRow">取消</vxe-button> <vxe-button mode="text" @click="clearRadioRowEvent" :disabled="!selectRow">取消</vxe-button>
@@ -34,13 +39,20 @@
<vxe-column field="status" title="补召进度"> <vxe-column field="status" title="补召进度">
<template #default="{ row }"> <template #default="{ row }">
<div class="finish" v-if="row.status == 100"> <div class="finish" v-if="row.status == 100">
<SuccessFilled style="width: 16px;" /><span class="ml5">补召完成</span> <SuccessFilled style="width: 16px" />
<span class="ml5">补召完成</span>
</div> </div>
<el-progress v-model.trim="row.status" v-else :class="row.status == 100 ? 'progress' : ''" <el-progress
:format="format" :stroke-width="10" striped :percentage="row.status" :duration="30" v-model.trim="row.status"
striped-flow /> v-else
:class="row.status == 100 ? 'progress' : ''"
:format="format"
:stroke-width="10"
striped
:percentage="row.status"
:duration="30"
striped-flow
/>
</template> </template>
</vxe-column> </vxe-column>
<vxe-column field="startTime" title="起始时间"></vxe-column> <vxe-column field="startTime" title="起始时间"></vxe-column>
@@ -58,10 +70,7 @@ import { useRouter, useRoute } from 'vue-router'
import { mainHeight } from '@/utils/layout' import { mainHeight } from '@/utils/layout'
import { VxeUI, VxeTableInstance, VxeTableEvents } from 'vxe-table' import { VxeUI, VxeTableInstance, VxeTableEvents } from 'vxe-table'
import { SuccessFilled } from '@element-plus/icons-vue' import { SuccessFilled } from '@element-plus/icons-vue'
import { import { Back, Setting, Search } from '@element-plus/icons-vue'
Back,
Setting, Search
} from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import mqtt from 'mqtt' import mqtt from 'mqtt'
defineOptions({ defineOptions({
@@ -75,7 +84,7 @@ const loading = ref(false)
const dirList = ref([]) const dirList = ref([])
const route: any = ref({}) const route: any = ref({})
const datePickerRef = ref() const datePickerRef = ref()
const format = (percentage) => (percentage === 100 ? '完成' : `${percentage}%`) const format = percentage => (percentage === 100 ? '完成' : `${percentage}%`)
const getMakeUpDataList = (row: any) => { const getMakeUpDataList = (row: any) => {
route.value = row route.value = row
loading.value = true loading.value = true
@@ -139,11 +148,11 @@ const handleUpDevice = () => {
} }
const radioChangeEvent: VxeTableEvents.RadioChange = ({ row }) => { const radioChangeEvent: VxeTableEvents.RadioChange = ({ row }) => {
datePickerRef.value.timeValue = [row.startTime.split(' ')[0] , row.endTime.split(' ')[0] ]
selectRow.value = row selectRow.value = row
// console.log('单选事件') // console.log('单选事件')
} }
const clearRadioRowEvent = () => { const clearRadioRowEvent = () => {
const $table = tableRef.value const $table = tableRef.value
if ($table) { if ($table) {
@@ -152,7 +161,7 @@ const clearRadioRowEvent = () => {
} }
} }
const mqttRef = ref() const mqttRef = ref()
const url: any = window.localStorage.getItem('MQTTURL') const url: any = window.localStorage.getItem('MQTTURL')
const connectMqtt = () => { const connectMqtt = () => {
if (mqttRef.value) { if (mqttRef.value) {
if (mqttRef.value.connected) { if (mqttRef.value.connected) {
@@ -173,10 +182,10 @@ const connectMqtt = () => {
const handleSearch = () => { const handleSearch = () => {
getMakeUpDataList(route.value) getMakeUpDataList(route.value)
} }
function parseStringToObject(str:string) { function parseStringToObject(str: string) {
const content = str.replace(/^{|}$/g, '') const content = str.replace(/^{|}$/g, '')
const pairs = content.split(',') const pairs = content.split(',')
const result:any = {} const result: any = {}
pairs.forEach(pair => { pairs.forEach(pair => {
const [key, value] = pair.split(':') const [key, value] = pair.split(':')
// 尝试将数字转换为Number类型 // 尝试将数字转换为Number类型
@@ -210,7 +219,6 @@ mqttRef.value.on('message', (topic: any, message: any) => {
let percentage = parseInt(Number((mqttMessage.value.nowStep / mqttMessage.value.allStep) * 100)) || 0 let percentage = parseInt(Number((mqttMessage.value.nowStep / mqttMessage.value.allStep) * 100)) || 0
if (percentage > 5) { if (percentage > 5) {
item.status = percentage item.status = percentage
} }
} }
// }) // })
@@ -226,6 +234,8 @@ mqttRef.value.on('close', function () {
console.log('mqtt客户端已断开连接.....') console.log('mqtt客户端已断开连接.....')
}) })
onMounted(() => { onMounted(() => {
datePickerRef.value.setInterval(5)
datePickerRef.value.setTimeOptions([{ label: '自定义', value: 5 }])
}) })
onBeforeUnmount(() => { onBeforeUnmount(() => {
if (mqttRef.value) { if (mqttRef.value) {
@@ -261,14 +271,21 @@ defineExpose({ getMakeUpDataList })
// } // }
// } // }
:deep(.el-progress-bar__inner--striped) { :deep(.el-progress-bar__inner--striped) {
background-image: linear-gradient(45deg, rgba(255, 255, 255, .3) 25%, transparent 0, transparent 50%, rgba(255, 255, 255, .3) 0, rgba(255, 255, 255, .3) 75%, transparent 0, transparent); background-image: linear-gradient(
45deg,
rgba(255, 255, 255, 0.3) 25%,
transparent 0,
transparent 50%,
rgba(255, 255, 255, 0.3) 0,
rgba(255, 255, 255, 0.3) 75%,
transparent 0,
transparent
);
} }
:deep(.progress) { :deep(.progress) {
.el-progress__text { .el-progress__text {
color: green; color: green;
} }
} }
@@ -276,6 +293,6 @@ defineExpose({ getMakeUpDataList })
display: flex; display: flex;
justify-content: center; justify-content: center;
font-weight: 550; font-weight: 550;
color: #009688 color: #009688;
} }
</style> </style>

View File

@@ -4,8 +4,8 @@
<div class="harmonic_select" v-if="!loading"> <div class="harmonic_select" v-if="!loading">
<el-form :model="searchForm" id="history_select"> <el-form :model="searchForm" id="history_select">
<el-form-item label="稳态指标"> <el-form-item label="稳态指标">
<el-select multiple collapse-tags collapse-tags-tooltip v-model.trim="searchForm.index" <el-select multiple collapse-tags collapse-tags-tooltip filterable v-model.trim="searchForm.index"
placeholder="请选择统计指标" :multiple-limit="3" value-key="id"> placeholder="请选择统计指标" :multiple-limit="3" value-key="id">
<el-option v-for="(item, index) in indexOptions" :label="item.name" :key="index" <el-option v-for="(item, index) in indexOptions" :label="item.name" :key="index"
:value="item"></el-option> :value="item"></el-option>
</el-select> </el-select>
@@ -347,7 +347,7 @@ const init = () => {
// } // }
// }, // },
boundaryGap: false, boundaryGap: false,
data: xAixsTimeList.value // data: xAixsTimeList.value
}, },
yAxis: { yAxis: {
// type: 'value', // type: 'value',

View File

@@ -2,7 +2,7 @@
<template> <template>
<div class="realtrend" v-loading="loading"> <div class="realtrend" v-loading="loading">
<div class="select" v-if="!loading"> <div class="select" v-if="!loading">
<div class="mr10">谐波次数 </div> <div class="mr10">次数</div>
<el-select v-model.trim="selectValue" style="width: 100px" @change="selectChange"> <el-select v-model.trim="selectValue" style="width: 100px" @change="selectChange">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select> </el-select>
@@ -29,24 +29,26 @@
</div> --> </div> -->
<div class="realtrend_table" v-if="Object.keys(tableData).length != 0"> <div class="realtrend_table" v-if="Object.keys(tableData).length != 0">
<div class="thead_left"> <div class="thead_left">
<p style=" font-weight: 700; background-color: #F3F6F9;">次数()</p> <p style="font-weight: 700; background-color: #f3f6f9">次数()</p>
<p>{{ item.groupName }}{{ item.unit ? '(' + item.unit + ')' : '' }}</p> <p>{{ item.groupName }}{{ item.unit ? '(' + item.unit + ')' : '' }}</p>
<!-- <p>国标限值{{ item.unit ? '(' + item.unit + ')' : '' }}</p> --> <!-- <p>国标限值{{ item.unit ? '(' + item.unit + ')' : '' }}</p> -->
</div> </div>
<div class="thead_right"> <div class="thead_right">
<div class="right_cell" v-for="(value, key, index) in tableData" :key="index"> <div class="right_cell" v-for="(value, key, index) in tableData" :key="index">
<p v-if="item.groupName.includes('间谐波')" style="background-color: #F3F6F9;"> <p v-if="item.groupName.includes('间谐波')" style="background-color: #f3f6f9">
{{ Number(String(key).replace('data', ' ')) - 0.5 }} {{ Number(String(key).replace('data', ' ')) - 0.5 }}
</p> </p>
<p v-else style="background-color: #F3F6F9;"> <p v-else style="background-color: #f3f6f9">
<span>{{ String(key).replace('data', ' ') }}</span> <span>{{ String(key).replace('data', ' ') }}</span>
</p> </p>
<p> <p>
<span v-if=" <span
String(key).includes('data') && v-if="
String(key) != 'dataLevel' && String(key).includes('data') &&
String(key) != 'dataTime' String(key) != 'dataLevel' &&
"> String(key) != 'dataTime'
"
>
{{ value }} {{ value }}
</span> </span>
</p> </p>
@@ -60,10 +62,7 @@
</span> </span>
</p> --> </p> -->
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="tab_info" v-if="Object.keys(tableData).length != 0"> <div class="tab_info" v-if="Object.keys(tableData).length != 0">
@@ -91,18 +90,17 @@ const selectValue = ref('1')
const options = [ const options = [
{ {
value: '3', value: '3',
label: '全部', label: '全部'
}, },
{ {
value: '1', value: '1',
label: '奇次', label: '奇次'
}, },
{ {
value: '2', value: '2',
label: '偶次', label: '偶次'
}, }
] ]
interface RowVO { interface RowVO {
[key: string]: any [key: string]: any
@@ -121,36 +119,58 @@ const gridOptions = ref<VxeGridProps<RowVO>>({
}) })
gridOptions.value = { ...defaultAttribute, ...gridOptions.value } gridOptions.value = { ...defaultAttribute, ...gridOptions.value }
const tabsList: any = ref([]) const tabsList: any = ref([
{
id: '6d5470f509ca271d7108a86e83bb283f',
groupName: '谐波电压含有率',
thdDataVOS: null,
thdDataTdVODatas: null,
unit: '%'
},
{
id: '8dc260f16280184e2b57d26668dc00b1',
groupName: '谐波电流幅值',
thdDataVOS: null,
thdDataTdVODatas: null,
unit: 'A'
},
{
id: 'ae31115b83f02f03a0d3bd65cb017121',
groupName: '间谐波电压含有率',
thdDataVOS: null,
thdDataTdVODatas: null,
unit: '%'
}
])
const loading: any = ref(true) const loading: any = ref(true)
//接收参数 //接收参数
const params = ref({}) const params = ref({})
const open = async (val: any) => { const open = async (val: any) => {
loading.value = true loading.value = true
//获取指标tab //获取指标tab
tabsList.value = [ // tabsList.value = [
{ // {
id: '6d5470f509ca271d7108a86e83bb283f', // id: '6d5470f509ca271d7108a86e83bb283f',
groupName: '谐波电压含有率', // groupName: '谐波电压含有率',
thdDataVOS: null, // thdDataVOS: null,
thdDataTdVODatas: null, // thdDataTdVODatas: null,
unit: '%' // unit: '%'
}, // },
{ // {
id: '8dc260f16280184e2b57d26668dc00b1', // id: '8dc260f16280184e2b57d26668dc00b1',
groupName: '谐波电流幅值', // groupName: '谐波电流幅值',
thdDataVOS: null, // thdDataVOS: null,
thdDataTdVODatas: null, // thdDataTdVODatas: null,
unit: 'A' // unit: 'A'
}, // },
{ // {
id: 'ae31115b83f02f03a0d3bd65cb017121', // id: 'ae31115b83f02f03a0d3bd65cb017121',
groupName: '间谐波电压含有率', // groupName: '间谐波电压含有率',
thdDataVOS: null, // thdDataVOS: null,
thdDataTdVODatas: null, // thdDataTdVODatas: null,
unit: '%' // unit: '%'
} // }
] // ]
if (tabsList.value.length != 0) { if (tabsList.value.length != 0) {
// activeName.value = tabsList.value[0]?.id // activeName.value = tabsList.value[0]?.id
activeName.value = val.activeTrendName || 0 activeName.value = val.activeTrendName || 0
@@ -222,13 +242,12 @@ const init = () => {
let list: any = [ let list: any = [
trendData.map((item: any) => { trendData.map((item: any) => {
return item.value return item.value
}), })
// gbData.value.map((item: any) => { // gbData.value.map((item: any) => {
// return item.value // return item.value
// }), // }),
] ]
let legendList = [tabsList.value[activeName.value]?.groupName, ] let legendList = [tabsList.value[activeName.value]?.groupName]
// let legendList = [tabsList.value[activeName.value]?.groupName, '国标限值',] // let legendList = [tabsList.value[activeName.value]?.groupName, '国标限值',]
// echartsData.value.legend.data = legendList // echartsData.value.legend.data = legendList
list.map((item: any, index: any) => { list.map((item: any, index: any) => {
@@ -269,11 +288,11 @@ const setRealTrendData = (val: any) => {
mqttMessage.value = val mqttMessage.value = val
for (let key in val) { for (let key in val) {
if (String(key).includes('data') && String(key) != 'dataLevel' && String(key) != 'dataTime') { if (String(key).includes('data') && String(key) != 'dataLevel' && String(key) != 'dataTime') {
const numberPart = parseInt(key.replace('data', '')); const numberPart = parseInt(key.replace('data', ''))
if (selectValue.value != '3') { if (selectValue.value != '3') {
if (selectValue.value == '2') { if (selectValue.value == '2') {
if (activeName.value == 2) { if (activeName.value == 2) {
if (numberPart % 2 !== 0) { if (numberPart % 2 !== 0 && numberPart < 17) {
tableData.value[key] = val[key] tableData.value[key] = val[key]
} }
} else { } else {
@@ -283,7 +302,7 @@ const setRealTrendData = (val: any) => {
} }
} else { } else {
if (activeName.value == 2) { if (activeName.value == 2) {
if (numberPart % 2 === 0) { if (numberPart % 2 === 0 && numberPart < 17) {
tableData.value[key] = val[key] tableData.value[key] = val[key]
} }
} else { } else {
@@ -292,19 +311,22 @@ const setRealTrendData = (val: any) => {
} }
} }
} }
} else { } else {
tableData.value[key] = val[key] if (activeName.value == 2) {
if (numberPart < 17) {
tableData.value[key] = val[key]
}
} else {
tableData.value[key] = val[key]
}
} }
} }
} }
if (!tabsList.value[activeName.value].groupName.includes('间谐波')) { if (!tabsList.value[activeName.value].groupName.includes('间谐波')) {
delete tableData.value.data1 delete tableData.value.data1
} else { } else {
console.log('不删除') // console.log('不删除')
} }
if (Object.keys(tableData.value).length != 0) { if (Object.keys(tableData.value).length != 0) {
init() init()
@@ -327,28 +349,21 @@ const setOverLimitData = (val: any) => {
if (activeName.value == 0) { if (activeName.value == 0) {
if (String(key).includes('uharm')) { if (String(key).includes('uharm')) {
if (key.startsWith('uharm')) { if (key.startsWith('uharm')) {
limitData.value[key] = val[key]
limitData.value[key] = val[key];
} }
} }
} else if (activeName.value == 1) { } else if (activeName.value == 1) {
if (String(key).includes('iharm')) { if (String(key).includes('iharm')) {
limitData.value[key] = val[key] limitData.value[key] = val[key]
} }
} else { } else {
if (String(key).includes('inuharm')) { if (String(key).includes('inuharm')) {
limitData.value[key] = val[key] limitData.value[key] = val[key]
} }
} }
} }
} }
onMounted(() => { }) onMounted(() => {})
defineExpose({ open, setRealTrendData, setOverLimitData }) defineExpose({ open, setRealTrendData, setOverLimitData })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -411,7 +426,6 @@ defineExpose({ open, setRealTrendData, setOverLimitData })
// } // }
.realtrend_table { .realtrend_table {
width: 100%; width: 100%;
height: auto; height: auto;
max-height: 150px; max-height: 150px;

View File

@@ -20,12 +20,13 @@
<el-button @click="handleBack" :icon="Back">返回</el-button> <el-button @click="handleBack" :icon="Back">返回</el-button>
</div> </div>
<!-- v-loading="loading" -->
<el-tabs <el-tabs
class="home_body" class="home_body"
type="border-card" type="border-card"
v-model.trim="activeName1" v-model.trim="activeName1"
@tab-click="handleClick" @tab-click="handleClick"
v-loading="loading"
> >
<el-tab-pane label="瞬时波形" name="ssbx" :style="'height:' + bxecharts + ';overflow-y: auto;'"> <el-tab-pane label="瞬时波形" name="ssbx" :style="'height:' + bxecharts + ';overflow-y: auto;'">
<shushiboxi <shushiboxi
@@ -122,7 +123,7 @@ const changeView = () => {
}, 500) }, 500)
setTimeout(() => { setTimeout(() => {
loading.value = false loading.value = false
}, 1500) }, 1000)
} }
const bxecharts: any = ref(mainHeight(190).height as any) const bxecharts: any = ref(mainHeight(190).height as any)
@@ -133,7 +134,7 @@ const handleClick = (tab: any, event: any) => {
}, 500) }, 500)
setTimeout(() => { setTimeout(() => {
loading.value = false loading.value = false
}, 1500) }, 1000)
} }
const handleBack = () => { const handleBack = () => {
emit('handleHideCharts') emit('handleHideCharts')

View File

@@ -1,7 +1,9 @@
<template> <template>
<div class="view"> <div class="view">
<TableHeader datePicker ref="headerRef" v-if="!isWaveCharts" :showReset="false"></TableHeader> <div v-show="!isWaveCharts">
<Table ref="tableRef" v-if="!isWaveCharts" /> <TableHeader datePicker ref="headerRef" :showReset="false"></TableHeader>
<Table ref="tableRef" />
</div>
<waveFormAnalysis <waveFormAnalysis
v-loading="loading" v-loading="loading"
v-if="isWaveCharts" v-if="isWaveCharts"
@@ -56,31 +58,30 @@ const tableStore: any = new TableStore({
} }
}, },
{ field: 'startTime', title: '发生时刻', minWidth: 170, sortable: true }, { field: 'startTime', title: '发生时刻', minWidth: 170, sortable: true },
{ field: 'showName', title: '事件描述', minWidth: 170 }, { field: 'showName', title: '事件描述', minWidth: 120 },
{ {
field: 'phaseType', field: 'phaseType',
title: '相别', title: '相别',
minWidth: 100, minWidth: 80,
formatter: (row: any) => { formatter: (row: any) => {
row.cellValue = row.cellValue ? row.cellValue : '/' return row.cellValue || '/'
return row.cellValue
} }
}, },
{ {
field: 'persistTime', field: 'persistTime',
title: '持续时间(s)', title: '持续时间(s)',
minWidth: 100, minWidth: 110,
formatter: (row: any) => { formatter: (row: any) => {
console.log('row.cellValue', row.cellValue) // console.log('🚀 ~ row.cellValue:', row.cellValue)
row.cellValue = row.cellValue ? row.cellValue.toFixed(2) : '/'
return row.cellValue return row.cellValue ? (row.cellValue - 0).toFixed(2) : '/'
}, },
sortable: true sortable: true
}, },
{ {
field: 'featureAmplitude', field: 'featureAmplitude',
title: '暂降(聚升)幅值(%)', title: '暂降(聚升)幅值(%)',
width: 100, minWidth: 130,
formatter: (row: any) => { formatter: (row: any) => {
//row.cellValue = row.cellValue + '' ? row.cellValue.toFixed(2) : '/' //row.cellValue = row.cellValue + '' ? row.cellValue.toFixed(2) : '/'
row.cellValue = row.cellValue != null ? Number(row.cellValue).toFixed(2) : '/' row.cellValue = row.cellValue != null ? Number(row.cellValue).toFixed(2) : '/'
@@ -92,9 +93,10 @@ const tableStore: any = new TableStore({
}, },
{ {
title: '操作', title: '操作',
fixed: 'right',
width: 180, width: 180,
render: 'buttons', render: 'buttons',
fixed: 'right',
buttons: [ buttons: [
{ {
name: 'edit', name: 'edit',
@@ -118,7 +120,9 @@ const tableStore: any = new TableStore({
boxoList.value = row boxoList.value = row
boxoList.value.systemType = 'YPT' boxoList.value.systemType = 'YPT'
boxoList.value.engineeringName = tableParams.value.engineeringName boxoList.value.engineeringName = tableParams.value.engineeringName
console.log("🚀 ~ tableParams.value.engineeringName:", tableParams.value.engineeringName) boxoList.value.featureAmplitude =
row.featureAmplitude != null ? Number(row.featureAmplitude / 100) : '-'
boxoList.value.persistTime = row.persistTime ? row.persistTime.toFixed(2) : '-'
wp.value = res.data wp.value = res.data
view.value = false view.value = false
view2.value = true view2.value = true
@@ -132,7 +136,8 @@ const tableStore: any = new TableStore({
nextTick(() => { nextTick(() => {
waveFormAnalysisRef.value && waveFormAnalysisRef.value.getWpData(wp.value, boxoList.value) waveFormAnalysisRef.value && waveFormAnalysisRef.value.getWpData(wp.value, boxoList.value)
waveFormAnalysisRef.value && waveFormAnalysisRef.value.setHeight(200, 345) // waveFormAnalysisRef.value && waveFormAnalysisRef.value.setHeight(200, 345)
waveFormAnalysisRef.value && waveFormAnalysisRef.value.setHeight(350, 345)
}) })
} }
}, },
@@ -194,7 +199,6 @@ const tableStore: any = new TableStore({
tableStore.table.params.devId = tableParams.value.devId tableStore.table.params.devId = tableParams.value.devId
tableStore.table.params.lineId = tableParams.value.lineId tableStore.table.params.lineId = tableParams.value.lineId
tableStore.table.params.list = tableParams.value.list tableStore.table.params.list = tableParams.value.list
console.log('🚀 ~ ableParams.value:', tableParams.value)
tableStore.table.params.type = 3 tableStore.table.params.type = 3
}, },
loadCallback: () => {} loadCallback: () => {}

View File

@@ -37,14 +37,16 @@
</div> </div>
</div> </div>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
<div class="view_bot"> <div class="view_bot">
<vxe-table border height="" :data="realList" :column-config="{ resizable: true, tooltip: true }" <vxe-table
:tooltip-config="{ enterable: true }"> border
height=""
:data="realList"
:column-config="{ resizable: true, tooltip: true }"
:tooltip-config="{ enterable: true }"
>
<vxe-colgroup align="center" :title="`电压有效值(${voltageUnit})`"> <vxe-colgroup align="center" :title="`电压有效值(${voltageUnit})`">
<vxe-column align="center" field="vRmsA" title="A相"></vxe-column> <vxe-column align="center" field="vRmsA" title="A相"></vxe-column>
<vxe-column align="center" field="vRmsB" title="B相"></vxe-column> <vxe-column align="center" field="vRmsB" title="B相"></vxe-column>
@@ -67,10 +69,15 @@
</vxe-colgroup> </vxe-colgroup>
</vxe-table> </vxe-table>
<br /> <br />
<vxe-table border height="" :data="realList" :column-config="{ resizable: true, tooltip: true }" <vxe-table
:tooltip-config="{ enterable: true }"> border
<vxe-column align="center" field="freqDev" width="140" title="频率(Hz)"></vxe-column> height=""
<vxe-column align="center" field="freq" width="120" title="频率偏差(Hz)"></vxe-column> :data="realList"
:column-config="{ resizable: true, tooltip: true }"
:tooltip-config="{ enterable: true }"
>
<vxe-column align="center" field="freq" width="140" title="频率(Hz)"></vxe-column>
<vxe-column align="center" field="freqDev" width="120" title="频率偏差(Hz)"></vxe-column>
<vxe-column align="center" width="180" field="vUnbalance" title="电压不平衡度(%)"></vxe-column> <vxe-column align="center" width="180" field="vUnbalance" title="电压不平衡度(%)"></vxe-column>
<vxe-column align="center" width="180" field="iUnbalance" title="电流不平衡度(%)"></vxe-column> <vxe-column align="center" width="180" field="iUnbalance" title="电流不平衡度(%)"></vxe-column>
<vxe-colgroup align="center" :title="`基波电压幅值(${voltageUnit})`"> <vxe-colgroup align="center" :title="`基波电压幅值(${voltageUnit})`">
@@ -85,8 +92,13 @@
</vxe-colgroup> </vxe-colgroup>
</vxe-table> </vxe-table>
<br /> <br />
<vxe-table border height="" :data="realList" :column-config="{ resizable: true, tooltip: true }" <vxe-table
:tooltip-config="{ enterable: true }"> border
height=""
:data="realList"
:column-config="{ resizable: true, tooltip: true }"
:tooltip-config="{ enterable: true }"
>
<vxe-colgroup align="center" title="电压偏差(%)"> <vxe-colgroup align="center" title="电压偏差(%)">
<vxe-column align="center" field="vDevA" title="A相"></vxe-column> <vxe-column align="center" field="vDevA" title="A相"></vxe-column>
<vxe-column align="center" field="vDevB" title="B相"></vxe-column> <vxe-column align="center" field="vDevB" title="B相"></vxe-column>
@@ -110,8 +122,13 @@
</vxe-colgroup> </vxe-colgroup>
</vxe-table> </vxe-table>
<br /> <br />
<vxe-table border height="" :data="realList" :column-config="{ resizable: true, tooltip: true }" <vxe-table
:tooltip-config="{ enterable: true }"> border
height=""
:data="realList"
:column-config="{ resizable: true, tooltip: true }"
:tooltip-config="{ enterable: true }"
>
<vxe-colgroup align="center" :title="`无功功率(${reactivePowerUnit})`"> <vxe-colgroup align="center" :title="`无功功率(${reactivePowerUnit})`">
<vxe-column align="center" field="qA" title="A相"></vxe-column> <vxe-column align="center" field="qA" title="A相"></vxe-column>
<vxe-column align="center" field="qB" title="B相"></vxe-column> <vxe-column align="center" field="qB" title="B相"></vxe-column>
@@ -128,13 +145,13 @@
<vxe-column align="center" field="sC" title="C相"></vxe-column> <vxe-column align="center" field="sC" title="C相"></vxe-column>
<vxe-column align="center" field="sTot" title="总"></vxe-column> <vxe-column align="center" field="sTot" title="总"></vxe-column>
</vxe-colgroup> </vxe-colgroup>
<vxe-colgroup align="center" title="功率因数"> <vxe-colgroup align="center" title="视在功率因数">
<vxe-column align="center" field="pfA" title="A相"></vxe-column> <vxe-column align="center" field="pfA" title="A相"></vxe-column>
<vxe-column align="center" field="pfB" title="B相"></vxe-column> <vxe-column align="center" field="pfB" title="B相"></vxe-column>
<vxe-column align="center" field="pfC" title="C相"></vxe-column> <vxe-column align="center" field="pfC" title="C相"></vxe-column>
<vxe-column align="center" field="pfTot" title="总"></vxe-column> <vxe-column align="center" field="pfTot" title="总"></vxe-column>
</vxe-colgroup> </vxe-colgroup>
<vxe-colgroup align="center" title="基波功率因数"> <vxe-colgroup align="center" title="位移功率因数">
<vxe-column align="center" field="dpfA" title="A相"></vxe-column> <vxe-column align="center" field="dpfA" title="A相"></vxe-column>
<vxe-column align="center" field="dpfB" title="B相"></vxe-column> <vxe-column align="center" field="dpfB" title="B相"></vxe-column>
<vxe-column align="center" field="dpfC" title="C相"></vxe-column> <vxe-column align="center" field="dpfC" title="C相"></vxe-column>
@@ -142,10 +159,6 @@
</vxe-colgroup> </vxe-colgroup>
</vxe-table> </vxe-table>
</div> </div>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@@ -171,7 +184,7 @@ const echartsDataA1: any = ref({})
const echartsDataA2: any = ref({}) const echartsDataA2: any = ref({})
const echartsDataA3: any = ref({}) const echartsDataA3: any = ref({})
const currentDataLevel = ref('Primary') const currentDataLevel = ref('Primary')
const previousDataLevel = ref('') const previousDataLevel = ref('')
//渲染中间相角图 //渲染中间相角图
@@ -264,10 +277,17 @@ const initRadioCharts = () => {
} }
}, },
// // 指针设置
// pointer: {
// length: '80%',
// width: 3
// },
// 指针设置 // 指针设置
pointer: { pointer: {
length: '80%', icon: 'path://m368.01136,209.80637l173.00807,-193.72679c19.14653,-21.43943 50.16392,-21.43943 69.31045,0l172.93149,193.72679c1.22537,1.37213 1.22537,3.51607 0,4.8882l-47.63657,53.34133c-1.22538,1.37213 -3.14003,1.37213 -4.36541,0l-113.65381,-127.26452c-1.91465,-2.14395 -5.20785,-0.60031 -5.20785,2.40122l0,731.94254c0,1.88667 -1.37855,3.43031 -3.06345,3.43031l-67.39579,0c-1.6849,0 -3.06345,-1.54364 -3.06345,-3.43031l0,-731.94254c0,-3.08728 -3.2932,-4.54517 -5.20785,-2.40122l-113.65381,127.26452c-1.22538,1.37213 -3.14003,1.37213 -4.36541,0l-47.63657,-53.34133c-1.22537,-1.37213 -1.22537,-3.51607 0,-4.88819l0,-0.00001M539,861.23064h73v800h-73z',
width: 3 length: '90%',
width: 15,
opacity: 1
}, },
detail: { detail: {
show: false show: false
@@ -364,10 +384,17 @@ const initRadioCharts = () => {
} }
}, },
// // 指针设置
// pointer: {
// length: '90%',
// width: 6
// },
// 指针设置 // 指针设置
pointer: { pointer: {
icon: 'path://m368.01136,209.80637l173.00807,-193.72679c19.14653,-21.43943 50.16392,-21.43943 69.31045,0l172.93149,193.72679c1.22537,1.37213 1.22537,3.51607 0,4.8882l-47.63657,53.34133c-1.22538,1.37213 -3.14003,1.37213 -4.36541,0l-113.65381,-127.26452c-1.91465,-2.14395 -5.20785,-0.60031 -5.20785,2.40122l0,731.94254c0,1.88667 -1.37855,3.43031 -3.06345,3.43031l-67.39579,0c-1.6849,0 -3.06345,-1.54364 -3.06345,-3.43031l0,-731.94254c0,-3.08728 -3.2932,-4.54517 -5.20785,-2.40122l-113.65381,127.26452c-1.22538,1.37213 -3.14003,1.37213 -4.36541,0l-47.63657,-53.34133c-1.22537,-1.37213 -1.22537,-3.51607 0,-4.88819l0,-0.00001M539,861.23064h73v800h-73z',
length: '90%', length: '90%',
width: 6 width: 15,
opacity: 1
}, },
detail: { detail: {
show: false show: false
@@ -549,25 +576,25 @@ const realList = ref<any>([])
// 计算电压单位 // 计算电压单位
const voltageUnit = computed(() => { const voltageUnit = computed(() => {
return currentDataLevel.value === 'Primary' ? 'kV' : 'V' return currentDataLevel.value === 'Primary' ? 'kV' : 'V'
}) })
// 计算功率单位 // 计算功率单位
const powerUnit = computed(() => { const powerUnit = computed(() => {
return currentDataLevel.value === 'Primary' ? 'kW' : 'W' return currentDataLevel.value === 'Primary' ? 'kW' : 'W'
}) })
// 计算无功功率单位 // 计算无功功率单位
const reactivePowerUnit = computed(() => { const reactivePowerUnit = computed(() => {
return currentDataLevel.value === 'Primary' ? 'kVar' : 'Var' return currentDataLevel.value === 'Primary' ? 'kVar' : 'Var'
}) })
// 计算视在功率单位 // 计算视在功率单位
const apparentPowerUnit = computed(() => { const apparentPowerUnit = computed(() => {
return currentDataLevel.value === 'Primary' ? 'kVA' : 'VA' return currentDataLevel.value === 'Primary' ? 'kVA' : 'VA'
}) })
const setRealData = (val: any,dataLevel:string) => { const setRealData = (val: any, dataLevel: string) => {
// 只有当 dataLevel 真正改变时才更新 // 只有当 dataLevel 真正改变时才更新
if (dataLevel !== previousDataLevel.value) { if (dataLevel !== previousDataLevel.value) {
currentDataLevel.value = dataLevel currentDataLevel.value = dataLevel
@@ -808,7 +835,6 @@ onMounted(() => {
} }
:deep(.view_bot) { :deep(.view_bot) {
.vxe-table--render-default .vxe-body--column:not(.col--ellipsis), .vxe-table--render-default .vxe-body--column:not(.col--ellipsis),
.vxe-table--render-default .vxe-footer--column:not(.col--ellipsis), .vxe-table--render-default .vxe-footer--column:not(.col--ellipsis),
.vxe-table--render-default .vxe-header--column:not(.col--ellipsis) { .vxe-table--render-default .vxe-header--column:not(.col--ellipsis) {

View File

@@ -9,9 +9,11 @@
</el-form-item> </el-form-item>
<el-form-item label="统计指标" label-width="80px"> <el-form-item label="统计指标" label-width="80px">
<el-select <el-select
style="width: 200px"
multiple multiple
:multiple-limit="3" :multiple-limit="3"
collapse-tags collapse-tags
filterable
collapse-tags-tooltip collapse-tags-tooltip
v-model="searchForm.index" v-model="searchForm.index"
placeholder="请选择统计指标" placeholder="请选择统计指标"
@@ -67,7 +69,7 @@
<el-option <el-option
v-for="vv in item.countOptions" v-for="vv in item.countOptions"
:key="vv" :key="vv"
:label="vv" :label="item.name.includes('间谐波') ? vv - 0.5 : vv"
:value="vv" :value="vv"
></el-option> ></el-option>
</el-select> </el-select>
@@ -157,7 +159,13 @@ const countOptions: any = ref([])
// Harmonic_Type // Harmonic_Type
// portable-harmonic // portable-harmonic
const legendDictList: any = ref([]) const legendDictList: any = ref([])
queryByCode(props?.TrendList?.lineType == 0 ? 'apf-harmonic' : 'portable-harmonic').then(res => { queryByCode(
props?.TrendList?.lineType == 0
? 'apf-harmonic'
: props?.TrendList?.conType == 1
? 'portable-harmonic-jx'
: 'portable-harmonic'
).then(res => {
queryCsDictTree(res.data.id).then(item => { queryCsDictTree(res.data.id).then(item => {
//排序 //排序
indexOptions.value = item.data.sort((a: any, b: any) => { indexOptions.value = item.data.sort((a: any, b: any) => {
@@ -185,15 +193,15 @@ queryByCode(props?.TrendList?.lineType == 0 ? 'apf-harmonic' : 'portable-harmoni
if (kk.harmStart && kk.harmEnd) { if (kk.harmStart && kk.harmEnd) {
range(0, 0, 0) range(0, 0, 0)
if (kk.showName == '间谐波电压含有率') { // if (kk.showName == '间谐波电压含有率') {
countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1).map( // countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1).map(
(item: any) => { // (item: any) => {
return item - 0.5 // return item - 0.5
} // }
) // )
} else { // } else {
countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1) countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1)
} // }
if (!countDataCopy.value[index].count || countDataCopy.value[index].count.length == 0) { if (!countDataCopy.value[index].count || countDataCopy.value[index].count.length == 0) {
countDataCopy.value[index].count = countDataCopy.value[index].countOptions[0] countDataCopy.value[index].count = countDataCopy.value[index].countOptions[0]
} }
@@ -232,7 +240,7 @@ const init = async () => {
loading.value = true loading.value = true
// 选择指标的时候切换legend内容和data数据 // 选择指标的时候切换legend内容和data数据
let list: any = [] let list: any = []
echartsData.value={} echartsData.value = {}
legendDictList.value?.selectedList?.map((item: any) => { legendDictList.value?.selectedList?.map((item: any) => {
searchForm.value.index.map((vv: any) => { searchForm.value.index.map((vv: any) => {
if (item.dataType == vv) { if (item.dataType == vv) {
@@ -260,7 +268,7 @@ const init = async () => {
let frequencys: any = null let frequencys: any = null
countData.value.map((item: any, index: any) => { countData.value.map((item: any, index: any) => {
if (item.name.includes('间谐波电压')) { if (item.name.includes('间谐波电压')) {
frequencys = item.count + 0.5 frequencys = item.count //+ 0.5
} else { } else {
frequencys = item.count frequencys = item.count
} }
@@ -859,4 +867,13 @@ defineExpose({ getTrendRequest })
min-width: 100px; min-width: 100px;
} }
} }
:deep(.el-select__selected-item) {
.is-closable {
width: 100px !important;
}
}
:deep(.el-form--inline .el-form-item) {
margin-right: 15px !important;
}
</style> </style>

View File

@@ -4,8 +4,8 @@
<div class="device-manage-right" :style="{ height: pageHeight.height }"> <div class="device-manage-right" :style="{ height: pageHeight.height }">
<el-descriptions title="用户基本信息" class="mb10" :column="2" border> <el-descriptions title="用户基本信息" class="mb10" :column="2" border>
<template #extra> <template #extra>
<el-button type="primary" icon="el-icon-Plus" @click="getMarketEnginner"> <el-button type="primary" icon="el-icon-Sort" @click="getMarketEnginner">
添加工程 绑定工程
</el-button> </el-button>
</template> </template>
<el-descriptions-item label="名称"> <el-descriptions-item label="名称">
@@ -29,7 +29,7 @@
</vxe-table> </vxe-table>
</div> </div>
</div> </div>
<el-dialog v-model.trim="dialogVisible" title="添加工程" class="cn-operate-dialog" :close-on-click-modal="false"> <el-dialog v-model.trim="dialogVisible" title="绑定工程" class="cn-operate-dialog" :close-on-click-modal="false">
<el-input maxlength="32" show-word-limit v-model.trim="filterText" icon="el-icon-Search" placeholder="请输入内容" <el-input maxlength="32" show-word-limit v-model.trim="filterText" icon="el-icon-Search" placeholder="请输入内容"
clearable style="margin-bottom: 10px"> clearable style="margin-bottom: 10px">
<template #prefix> <template #prefix>

View File

@@ -27,7 +27,7 @@
<el-input <el-input
maxlength="32" maxlength="32"
show-word-limit show-word-limit
style="width: 200px; height: 32px" style="width: 240px; height: 32px"
placeholder="请输入文件或文件夹名称" placeholder="请输入文件或文件夹名称"
clearable clearable
v-model.trim="filterText" v-model.trim="filterText"
@@ -71,7 +71,7 @@
v-bind="defaultAttribute" v-bind="defaultAttribute"
> >
<vxe-column type="seq" title="序号" width="80"></vxe-column> <vxe-column type="seq" title="序号" width="80"></vxe-column>
<vxe-column field="prjDataPath" align="center" title="名称" #default="{ row }"> <vxe-column field="prjDataPath" align="center" title="名称" minWidth="180" #default="{ row }">
<span <span
style="cursor: pointer; color: #551a8b" style="cursor: pointer; color: #551a8b"
:style="{ :style="{
@@ -91,15 +91,15 @@
</span> </span>
</vxe-column> </vxe-column>
<vxe-column field="startTime" align="center" title="文件时间" width="240" #default="{ row }"> <vxe-column field="startTime" align="center" title="文件时间" minWidth="140" #default="{ row }">
{{ row.startTime ? row.startTime : '/' }} {{ row.startTime ? row.startTime : '/' }}
</vxe-column> </vxe-column>
<vxe-column field="type" align="center" title="类型" width="120" #default="{ row }"> <vxe-column field="type" align="center" title="类型" minWidth="100" #default="{ row }">
<span> <span>
{{ row.type == 'dir' ? '文件夹' : row.type == 'file' ? '文件' : '/' }} {{ row.type == 'dir' ? '文件夹' : row.type == 'file' ? '文件' : '/' }}
</span> </span>
</vxe-column> </vxe-column>
<vxe-column field="size" align="center" width="120" title="大小" #default="{ row }"> <vxe-column field="size" align="center" minWidth="100" title="大小" #default="{ row }">
<span> <span>
{{ row.size && row.type == 'file' ? row.size + 'KB' : '/' }} {{ row.size && row.type == 'file' ? row.size + 'KB' : '/' }}
</span> </span>
@@ -107,7 +107,7 @@
<!--<vxe-column field="fileCheck" align="center" title="文件校验码" width="100" #default="{ row }"> <!--<vxe-column field="fileCheck" align="center" title="文件校验码" width="100" #default="{ row }">
{{ row.fileCheck ? row.fileCheck : '/' }} {{ row.fileCheck ? row.fileCheck : '/' }}
</vxe-column> --> </vxe-column> -->
<vxe-column title="操作" width="200px"> <vxe-column title="操作" width="120px" fixed="right">
<template #default="{ row }"> <template #default="{ row }">
<el-button link size="small" type="danger" @click="handleDelDirOrFile(row)">删除</el-button> <el-button link size="small" type="danger" @click="handleDelDirOrFile(row)">删除</el-button>
<el-button <el-button
@@ -596,10 +596,10 @@ mqttRef.value.on('connect', (e: any) => {
}) })
const mqttMessage = ref<any>({}) const mqttMessage = ref<any>({})
const status: any = ref() const status: any = ref()
function parseStringToObject(str:string) { function parseStringToObject(str: string) {
const content = str.replace(/^{|}$/g, '') const content = str.replace(/^{|}$/g, '')
const pairs = content.split(',') const pairs = content.split(',')
const result:any = {} const result: any = {}
pairs.forEach(pair => { pairs.forEach(pair => {
const [key, value] = pair.split(':') const [key, value] = pair.split(':')
// 尝试将数字转换为Number类型 // 尝试将数字转换为Number类型
@@ -612,7 +612,6 @@ mqttRef.value.on('message', (topic: any, message: any) => {
let str = JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message)))) let str = JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message))))
let regex = /fileName:(.*?),allStep/ let regex = /fileName:(.*?),allStep/
let regex1 = /allStep:(.*?),nowStep/ let regex1 = /allStep:(.*?),nowStep/
let regex2 = /nowStep:(.*?),userId/ let regex2 = /nowStep:(.*?),userId/

View File

@@ -1,212 +1,215 @@
<!-- 设备文件下载 --> <!-- 设备文件下载 -->
<template> <template>
<div :class="downLoading ? 'all_disabled' : ''"> <div :class="downLoading ? 'all_disabled' : ''">
<el-dialog v-model.trim="dialogVisible" title="文件信息" width="50%" @closed="handleClose"> <el-dialog v-model.trim="dialogVisible" title="文件信息" width="50%" @closed="handleClose">
<div v-loading="loading"> <div v-loading="loading">
<div class="download_progress" <div
v-if="mqttFileName.includes(fileNameInfoMation) && status != 0 && status != 100"> class="download_progress"
<div class="progress_left"> v-if="mqttFileName.includes(fileNameInfoMation) && status != 0 && status != 100"
正在下载 >
{{ <div class="progress_left">
// fileData?.prjDataPath 正在下载
// ? fileData?.prjDataPath.split('/')[fileData?.prjDataPath.split('/').length - 1] {{
// : '/' // fileData?.prjDataPath
mqttFileName // ? fileData?.prjDataPath.split('/')[fileData?.prjDataPath.split('/').length - 1]
}} // : '/'
</div> mqttFileName
<div class="progress_right"> }}
<el-progress :percentage="status" /> </div>
</div> <div class="progress_right">
</div> <el-progress :percentage="status" />
<el-descriptions title="" style="margin: 10px 0" :column="2" :border="true"> </div>
<el-descriptions-item label="文件名称"> </div>
{{ <el-descriptions title="" style="margin: 10px 0" :column="2" :border="true">
fileData?.prjDataPath <el-descriptions-item label="文件名称">
? fileData?.prjDataPath.split('/')[fileData?.prjDataPath.split('/').length - 1] {{
: '/' fileData?.prjDataPath
}} ? fileData?.prjDataPath.split('/')[fileData?.prjDataPath.split('/').length - 1]
</el-descriptions-item> : '/'
<el-descriptions-item label="文件大小"> }}
{{ fileData?.size ? fileData?.size + '字节' : '/' }} </el-descriptions-item>
</el-descriptions-item> <el-descriptions-item label="文件大小">
<el-descriptions-item label="文件时间"> {{ fileData?.size ? fileData?.size + '字节' : '/' }}
{{ fileData?.startTime ? fileData?.startTime : '/' }} </el-descriptions-item>
</el-descriptions-item> <el-descriptions-item label="文件时间">
<el-descriptions-item label="文件校验码"> {{ fileData?.startTime ? fileData?.startTime : '/' }}
{{ fileData?.fileCheck ? fileData?.fileCheck : '/' }} </el-descriptions-item>
</el-descriptions-item> <el-descriptions-item label="文件校验码">
</el-descriptions> {{ fileData?.fileCheck ? fileData?.fileCheck : '/' }}
</div> </el-descriptions-item>
</el-descriptions>
<template #footer> </div>
<div class="dialog-footer download_status">
<el-button @click="handleClose">取消</el-button> <template #footer>
<el-button type="primary" @click="handleDownLoad" :disabled="loading" :loading="downLoading"> <div class="dialog-footer download_status">
{{ downLoading ? '下载中...' : '下载' }} <el-button @click="handleClose">取消</el-button>
</el-button> <el-button type="primary" @click="handleDownLoad" :disabled="loading" :loading="downLoading">
</div> {{ downLoading ? '下载中...' : '下载' }}
</template> </el-button>
</el-dialog> </div>
</div> </template>
</template> </el-dialog>
<script lang="ts" setup> </div>
import { ref, onMounted, defineExpose, onUnmounted, defineEmits } from 'vue' </template>
import { <script lang="ts" setup>
getFileServiceFileOrDir, import { ref, onMounted, defineExpose, onUnmounted, defineEmits } from 'vue'
downLoadDeviceFile, import {
downLoadDeviceFilePath getFileServiceFileOrDir,
} from '@/api/cs-device-boot/fileService.ts' downLoadDeviceFile,
import { ElMessage } from 'element-plus' downLoadDeviceFilePath
import { useAdminInfo } from '@/stores/adminInfo' } from '@/api/cs-device-boot/fileService.ts'
import { downLoadFile } from '@/api/cs-system-boot/manage.ts' import { ElMessage } from 'element-plus'
const dialogVisible = ref(false) import { useAdminInfo } from '@/stores/adminInfo'
const loading = ref(false) import { downLoadFile } from '@/api/cs-system-boot/manage.ts'
const adminInfo = useAdminInfo() import { log } from 'console'
const downLoading = ref(false) const dialogVisible = ref(false)
const emit = defineEmits(['downLoadFile']) const loading = ref(false)
const handleClose = () => { const adminInfo = useAdminInfo()
status.value = 0 const downLoading = ref(false)
mqttFileName.value = '' const emit = defineEmits(['downLoadFile'])
downLoading.value = false const handleClose = () => {
dialogVisible.value = false status.value = 0
} mqttFileName.value = ''
//文件信息 downLoading.value = false
const fileData: any = ref({}) dialogVisible.value = false
//文件名称信息 }
const fileNameInfoMation = ref<any>('') //文件信息
const open = async (row: any, id: any) => { const fileData: any = ref({})
status.value = 0 //文件名称信息
fileData.value = {} const fileNameInfoMation = ref<any>('')
dialogVisible.value = true const open = async (row: any, id: any) => {
loading.value = true status.value = 0
const obj = { fileData.value = {}
nDid: id, dialogVisible.value = true
name: row.prjDataPath, loading.value = true
type: row.type const obj = {
} nDid: id,
await getFileServiceFileOrDir(obj).then((res: any) => { name: row.prjDataPath,
if (res.code == 'A0000') { type: row.type
if (res.data && res.data.length != 0) { }
fileData.value = res.data[0] await getFileServiceFileOrDir(obj).then((res: any) => {
fileData.value.nDid = id if (res.code == 'A0000') {
if (fileData.value && fileData.value.prjDataPath) { if (res.data && res.data.length != 0) {
fileNameInfoMation.value = fileData.value = res.data[0]
fileData.value.prjDataPath.split('/')[fileData.value.prjDataPath.split('/').length - 1] fileData.value.nDid = id
} else { if (fileData.value && fileData.value.prjDataPath) {
fileNameInfoMation.value = '/' fileNameInfoMation.value =
} fileData.value.prjDataPath.split('/')[fileData.value.prjDataPath.split('/').length - 1]
} } else {
loading.value = false fileNameInfoMation.value = '/'
} }
}) }
} loading.value = false
const handleDownLoad = () => { }
const obj = { })
nDid: fileData.value.nDid, }
name: fileData.value.prjDataPath, const handleDownLoad = () => {
size: fileData.value.size, const obj = {
fileCheck: fileData.value.fileCheck nDid: fileData.value.nDid,
} name: fileData.value.prjDataPath,
downLoading.value = true size: fileData.value.size,
downLoadDeviceFile(obj) fileCheck: fileData.value.fileCheck
.then((res: any) => { }
if (res.code == 'A0000') { downLoading.value = true
// downLoadFile(res.data).then((resp: any) => { downLoadDeviceFile(obj)
// if (resp.type != 'application/json') { .then((res: any) => {
// // 'application/vnd.ms-excel' if (res.code == 'A0000') {
// let blob = new Blob([resp], { type: resp.type }) // downLoadFile(res.data).then((resp: any) => {
// const url = window.URL.createObjectURL(blob) // if (resp.type != 'application/json') {
// const link = document.createElement('a') // // 'application/vnd.ms-excel'
// link.href = url // let blob = new Blob([resp], { type: resp.type })
// link.download = fileData.value?.prjDataPath // const url = window.URL.createObjectURL(blob)
// ? fileData.value?.prjDataPath.split('/')[fileData.value?.prjDataPath.split('/').length - 1] // const link = document.createElement('a')
// : '/' // link.href = url
// document.body.appendChild(link) // link.download = fileData.value?.prjDataPath
// downLoading.value = false // ? fileData.value?.prjDataPath.split('/')[fileData.value?.prjDataPath.split('/').length - 1]
// link.click() // : '/'
// status.value = 100 // document.body.appendChild(link)
// ElMessage.success('文件下载成功') // downLoading.value = false
// link.remove() // link.click()
// handleClose() // status.value = 100
// } else { // ElMessage.success('文件下载成功')
// if (resp.code == 'A0000') { // link.remove()
// window.open(res.data, '_blank') // handleClose()
// downLoading.value = false // } else {
// ElMessage.success(resp.message) // if (resp.code == 'A0000') {
// handleClose() // window.open(res.data, '_blank')
// } // downLoading.value = false
// } // ElMessage.success(resp.message)
// }) // handleClose()
} // }
}) // }
.catch(e => { // })
console.log(e, '0000000') }
if (e) { })
downLoading.value = false .catch(e => {
} console.log(e, '0000000')
}) if (e) {
} downLoading.value = false
onMounted(() => { }) }
onUnmounted(() => { }) })
const status = ref(0) }
const mqttFileName = ref('') onMounted(() => {})
const setStatus = (val: any) => { onUnmounted(() => {})
status.value = parseInt(Number((val.nowStep / val.allStep) * 100)) || 0 const status = ref(0)
const mqttFileName = ref('')
mqttFileName.value = val.fileName const setStatus = (val: any) => {
if (adminInfo.userIndex != val.userId) return status.value = parseInt(Number((val.nowStep / val.allStep) * 100)) || 0
downLoading.value = true
if (status.value == 100) { mqttFileName.value = val.fileName
downLoadDeviceFilePath({ nDid: fileData.value.nDid, name: fileData.value.prjDataPath }).then((ress: any) => { if (adminInfo.userIndex != val.userId) return
if (ress.code == 'A0000') { downLoading.value = true
downLoadFile(ress.data).then((resp: any) => { if (status.value == 100) {
if (resp.type != 'application/json') { downLoadDeviceFilePath({ nDid: fileData.value.nDid, name: fileData.value.prjDataPath }).then((ress: any) => {
// 'application/vnd.ms-excel' if (ress.code == 'A0000') {
let blob = new Blob([resp], { type: resp.type }) downLoadFile(ress.data).then((resp: any) => {
const url = window.URL.createObjectURL(blob) if (resp.type != 'application/json') {
const link = document.createElement('a') // 'application/vnd.ms-excel'
link.href = url let blob = new Blob([resp], { type: resp.type })
link.download = fileData.value?.prjDataPath const url = window.URL.createObjectURL(blob)
? fileData.value?.prjDataPath.split('/')[fileData.value?.prjDataPath.split('/').length - 1] const link = document.createElement('a')
: '/' link.href = url
document.body.appendChild(link) link.download = fileData.value?.prjDataPath
downLoading.value = false ? fileData.value?.prjDataPath.split('/')[fileData.value?.prjDataPath.split('/').length - 1]
link.click() : '/'
status.value = 100 document.body.appendChild(link)
ElMessage.success('文件下载成功') downLoading.value = false
link.remove() link.click()
handleClose() status.value = 100
} else { ElMessage.success('文件下载成功')
if (resp.code == 'A0000') { link.remove()
window.open(ress.data, '_blank') handleClose()
downLoading.value = false } else {
ElMessage.success(resp.message) if (resp.code == 'A0000') {
handleClose() window.open(ress.data, '_blank')
} downLoading.value = false
} ElMessage.success(resp.message)
}) handleClose()
} }
}) }
} })
} }
defineExpose({ open, setStatus }) })
</script> }
<style lang="scss" scoped> }
.download_progress { defineExpose({ open, setStatus })
display: flex; </script>
width: 100%; <style lang="scss" scoped>
margin: 10px 0; .download_progress {
align-items: center; display: flex;
justify-content: space-between; width: 100%;
margin: 10px 0;
.progress_left { align-items: center;
width: auto; justify-content: space-between;
}
.progress_left {
.progress_right { width: auto;
flex: 1; }
padding-left: 10px;
box-sizing: border-box; .progress_right {
} flex: 1;
} padding-left: 10px;
</style> box-sizing: border-box;
}
}
</style>

View File

@@ -1,315 +1,340 @@
<!-- 设备管理 --> <!-- 设备管理 -->
<template> <template>
<div class="default-main device-manage" :style="{ height: pageHeight.height }" v-loading="loading"> <div class="default-main device-manage" :style="{ height: pageHeight.height }" v-loading="loading">
<DeviceTree @node-click="nodeClick" @init="nodeClick" @deviceTypeChange="deviceTypeChange"></DeviceTree> <DeviceTree @node-click="nodeClick" @init="nodeClick" @deviceTypeChange="deviceTypeChange"></DeviceTree>
<div class="device-manage-right" v-if="deviceData"> <div class="device-manage-right" v-if="deviceData">
<el-descriptions title="基础信息" class="mb10" :column="3" border> <el-descriptions title="基础信息" class="mb10" :column="3" border>
<template #extra> <template #extra>
<!-- <el-button <!-- <el-button
type="primary" type="primary"
icon="el-icon-Share" icon="el-icon-Share"
@click="openGroup" @click="openGroup"
:loading="getGroupLoading" :loading="getGroupLoading"
> >
模版数据分组 模版数据分组
</el-button> --> </el-button> -->
<el-button icon="el-icon-Refresh" v-if="showButtom" @click="handleRestartDevice" type="primary" <el-button
:loading="deviceRestartLoading"> icon="el-icon-Refresh"
装置重启 v-if="showButtom && pName == '治理设备'"
</el-button> @click="handleRestartDevice"
</template> type="primary"
<el-descriptions-item label="名称"> :loading="deviceRestartLoading"
{{ deviceData.name }} >
</el-descriptions-item> 装置重启
<el-descriptions-item label="类型"> </el-button>
{{ echoName(deviceData.devType, devTypeOptions) }} </template>
</el-descriptions-item> <el-descriptions-item label="名称">
{{ deviceData.name || '/' }}
<el-descriptions-item label="接入方式"> </el-descriptions-item>
{{ deviceData.devAccessMethod }} <el-descriptions-item label="类型">
</el-descriptions-item> {{ echoName(deviceData.devType, devTypeOptions) || '/' }}
<el-descriptions-item label="网络设备ID"> </el-descriptions-item>
{{ deviceData.ndid }}
</el-descriptions-item> <el-descriptions-item label="接入方式">
<el-descriptions-item label="型号"> {{ deviceData.devAccessMethod || '/' }}
{{ echoName(deviceData.devModel, devModelOptions) }} </el-descriptions-item>
</el-descriptions-item> <el-descriptions-item label="网络设备ID">
<el-descriptions-item label="首次接入日期"> {{ deviceData.ndid || '/' }}
{{ deviceData.time }} </el-descriptions-item>
</el-descriptions-item> <el-descriptions-item label="型号">
<el-descriptions-item label="应用程序版本号"> {{ echoName(deviceData.devModel, devModelOptions) || '/' }}
{{ deviceData.appVersion }} </el-descriptions-item>
</el-descriptions-item> <el-descriptions-item label="首次接入日期">
<el-descriptions-item label="应用程序发布日期"> {{ deviceData.time || '/' }}
{{ deviceData.appDate }} </el-descriptions-item>
</el-descriptions-item> <el-descriptions-item label="应用程序版本号">
<el-descriptions-item label="应用程序校验码"> {{ deviceData.appVersion || '/' }}
{{ deviceData.appCheck }} </el-descriptions-item>
</el-descriptions-item> <el-descriptions-item label="应用程序发布日期">
</el-descriptions> {{ deviceData.appDate || '/' }}
<div style="position: relative"> </el-descriptions-item>
<el-descriptions-item label="应用程序校验码">
{{ deviceData.appCheck || '/' }}
<el-tabs v-model.trim="dataSet" type="border-card" class="device-manage-box-card" </el-descriptions-item>
@tab-click="handleClick"> </el-descriptions>
<el-tab-pane lazy :label="item.name" :name="item.id" v-for="(item, index) in deviceData.dataSetList" <div style="position: relative">
:key="index"></el-tab-pane> <el-tabs
<div :style="{ height: tableHeight }" v-loading="tableLoading"> v-model.trim="dataSet"
<vxe-table v-bind="defaultAttribute" :data="tableData" height="auto" ref="xTableRef" type="border-card"
style="width: 100%"> class="device-manage-box-card"
<vxe-column type="seq" title="序号" width="80"></vxe-column> @tab-click="handleClick"
<vxe-column field="name" title="数据名称"></vxe-column> >
<vxe-column field="phasic" title="相别"></vxe-column> <el-tab-pane
<vxe-column field="type" title="数据类型"></vxe-column> lazy
<vxe-column field="unit" title="单位"></vxe-column> :label="item.name"
<vxe-column field="startTimes" title="开始次数"></vxe-column> :name="item.id"
<vxe-column field="endTimes" title="结束次数"></vxe-column> v-for="(item, index) in deviceData.dataSetList"
</vxe-table> :key="index"
></el-tab-pane>
</div> <div :style="{ height: tableHeight }" v-loading="tableLoading">
<vxe-table
</el-tabs> v-bind="defaultAttribute"
<el-button icon="el-icon-Download" type="primary" @click="exportData" class="export-btn">导出</el-button> :data="tableData"
</div> height="auto"
</div> ref="xTableRef"
<el-empty v-else description="请选择设备" class="device-manage-right" /> style="width: 100%"
<MangePopup ref="mangePopup" /> >
</div> <vxe-column type="seq" title="序号" width="80"></vxe-column>
</template> <vxe-column field="name" title="数据名称"></vxe-column>
<vxe-column field="phasic" title="相别"></vxe-column>
<script setup lang="ts"> <vxe-column field="type" title="数据类型"></vxe-column>
defineOptions({ <vxe-column field="unit" title="单位"></vxe-column>
name: 'govern/device/manage' <vxe-column field="startTimes" title="开始次数"></vxe-column>
}) <vxe-column field="endTimes" title="结束次数"></vxe-column>
</vxe-table>
import MangePopup from './popup.vue' </div>
import DeviceTree from '@/components/tree/govern/deviceTree.vue' </el-tabs>
import { mainHeight } from '@/utils/layout' <el-button icon="el-icon-Download" type="primary" @click="exportData" class="export-btn">
import { queryByCode, queryByid, queryCsDictTree } from '@/api/system-boot/dictTree' 导出
import { getDeviceData } from '@/api/cs-device-boot/EquipmentDelivery' </el-button>
import { getTargetById } from '@/api/cs-device-boot/csDataArray' </div>
import { getGroup } from '@/api/cs-device-boot/csGroup' </div>
import { ref } from 'vue' <el-empty v-else description="请选择设备" class="device-manage-right" />
import { useAdminInfo } from '@/stores/adminInfo' <MangePopup ref="mangePopup" />
import { passwordConfirm } from '@/api/user-boot/user' </div>
import { ElMessage, ElMessageBox } from 'element-plus' </template>
import {
reStartDevice, <script setup lang="ts">
} from '@/api/cs-device-boot/fileService' defineOptions({
import { defaultAttribute } from '@/components/table/defaultAttribute' name: 'govern/device/manage'
const pageHeight = mainHeight(20) })
const adminInfo = useAdminInfo()
const showButtom = ref(adminInfo.roleCode.includes('operation_manager') || adminInfo.roleCode.includes('root')) import MangePopup from './popup.vue'
import DeviceTree from '@/components/tree/govern/deviceTree.vue'
const loading = ref(true) import { mainHeight } from '@/utils/layout'
const nDid = ref<string>('') import { queryByCode, queryByid, queryCsDictTree } from '@/api/system-boot/dictTree'
const tableLoading = ref(false) import { getDeviceData } from '@/api/cs-device-boot/EquipmentDelivery'
const getGroupLoading = ref(false) import { getTargetById } from '@/api/cs-device-boot/csDataArray'
const deviceData = ref<any>(null) import { getGroup } from '@/api/cs-device-boot/csGroup'
const dataSet = ref('') import { ref } from 'vue'
const devTypeOptions = ref([]) import { useAdminInfo } from '@/stores/adminInfo'
const devModelOptions = ref([]) import { passwordConfirm } from '@/api/user-boot/user'
const tableData = ref([]) import { ElMessage, ElMessageBox } from 'element-plus'
const tableHeight = mainHeight(260).height import { reStartDevice } from '@/api/cs-device-boot/fileService'
const mangePopup = ref() import { defaultAttribute } from '@/components/table/defaultAttribute'
const activeName = ref(0) const pageHeight = mainHeight(20)
const xTableRef = ref() const adminInfo = useAdminInfo()
//治理设备和便携式设备切换判断 const showButtom = ref(adminInfo.roleCode.includes('operation_manager') || adminInfo.roleCode.includes('root'))
const deviceType = ref('0') const pName = ref('')
const deviceTypeChange = (val: any, obj: any) => { const loading = ref(true)
deviceType.value = val const nDid = ref<string>('')
nodeClick(obj) const tableLoading = ref(false)
const getGroupLoading = ref(false)
} const deviceData = ref<any>(null)
// 树节点点击 const dataSet = ref('')
const nodeClick = (e: anyObj) => { const devTypeOptions: any = ref([])
if (!e) { const devModelOptions = ref([])
loading.value = false const tableData = ref([])
return const tableHeight = mainHeight(260).height
} const mangePopup = ref()
if (e.level == 2) { const activeName = ref(0)
nDid.value = e.ndid const xTableRef = ref()
loading.value = true //治理设备和便携式设备切换判断
getDeviceData(e.id, 'rt', '').then((res: any) => { const deviceType = ref('0')
deviceData.value = res.data const deviceTypeChange = (val: any, obj: any) => {
loading.value = false deviceType.value = val
if (!res.data.dataSetList) { nodeClick(obj)
dataSet.value = '' }
tableData.value = [] // 树节点点击
} else { const nodeClick = (e: anyObj) => {
if (res.data.dataSetList && res.data.dataSetList[0]?.id) { console.log('🚀 ~ nodeClick ~ e:', e)
dataSet.value = res.data.dataSetList[0]?.id if (!e) {
} else { loading.value = false
dataSet.value = '' return
tableData.value = [] }
} if (e.level == 2) {
handleClick() pName.value = e.pName
} nDid.value = e.ndid
}) loading.value = true
} getDeviceData(e.id, 'rt', '').then((res: any) => {
} deviceData.value = res.data
//tab点击事件 loading.value = false
const handleClick = () => { if (!res.data.dataSetList) {
tableLoading.value = true dataSet.value = ''
tableData.value = [] tableData.value = []
setTimeout(() => { } else {
getTargetById(dataSet.value).then(res => { if (res.data.dataSetList && res.data.dataSetList[0]?.id) {
tableData.value = res.data dataSet.value = res.data.dataSetList[0]?.id
tableLoading.value = false } else {
}) dataSet.value = ''
}, 100) tableData.value = []
} }
queryByCode('Device_Type').then(res => { handleClick()
queryCsDictTree(res.data.id).then(res => { }
devTypeOptions.value = res.data.map((item: any) => { })
return { }
value: item.id, }
label: item.name, //tab点击事件
...item const handleClick = () => {
} tableLoading.value = true
}) tableData.value = []
}) setTimeout(() => {
queryByid(res.data.id).then(res => { getTargetById(dataSet.value).then(res => {
devModelOptions.value = res.data.map((item: any) => { tableData.value = res.data
return { tableLoading.value = false
value: item.id, })
label: item.name, }, 100)
...item }
} queryByCode('Device_Type').then(async res => {
}) await queryCsDictTree(res.data.id).then(res => {
}) devTypeOptions.value = res.data.map((item: any) => {
}) return {
const echoName = (value: any, arr: any[]) => { value: item.id,
return arr.find(item => item.value == value)?.label label: item.name,
} ...item
const openGroup = () => { }
if (!dataSet.value) { })
return ElMessage.warning('暂无数据') })
} await queryByid(res.data.id).then(res => {
getGroupLoading.value = true devModelOptions.value = res.data.map((item: any) => {
getGroup(dataSet.value).then((res: any) => { return {
const call = (data: any[]) => { value: item.id,
data.forEach(item => { label: item.name,
item.label = item.name ...item
item.isShow = item.isShow == 1 }
if (item.children && item.children.length > 0) { })
call(item.children) })
} await queryByCode('DEV_CLD').then(k => {
}) devTypeOptions.value.push(k.data)
} return queryCsDictTree(k.data.id).then(s => {
call(res.data) let list = s.data.map((item: any) => {
getGroupLoading.value = false return {
mangePopup.value.open({ value: item.id,
deviceData: deviceData.value, label: item.name,
dataSetName: deviceData.value.dataSetList.filter((item: any) => item.id == dataSet.value)[0]?.name, ...item
dataSet: dataSet.value, }
tree: res.data })
})
}) devModelOptions.value.push(...list)
} })
//装置重启 })
const deviceRestartLoading = ref<boolean>(false) })
const handleRestartDevice = () => { const echoName = (value: any, arr: any[]) => {
deviceRestartLoading.value = true return arr.find(item => item.id == value)?.name
ElMessageBox.prompt('二次校验密码确认', '装置重启', { }
confirmButtonText: '确认', const openGroup = () => {
cancelButtonText: '取消', if (!dataSet.value) {
customClass: 'customInput', return ElMessage.warning('暂无数据')
inputType: 'text', }
beforeClose: (action, instance, done) => { getGroupLoading.value = true
getGroup(dataSet.value).then((res: any) => {
if (action === 'confirm') { const call = (data: any[]) => {
if (instance.inputValue == null) { data.forEach(item => {
return ElMessage.warning('请输入密码') item.label = item.name
} else if (instance.inputValue?.length > 32) { item.isShow = item.isShow == 1
return ElMessage.warning('密码长度不能超过32位,当前密码长度为' + instance.inputValue.length) if (item.children && item.children.length > 0) {
} else { call(item.children)
done(); }
} })
}
} else { call(res.data)
done(); getGroupLoading.value = false
} mangePopup.value.open({
} deviceData: deviceData.value,
}) dataSetName: deviceData.value.dataSetList.filter((item: any) => item.id == dataSet.value)[0]?.name,
.then(({ value }) => { dataSet: dataSet.value,
if (!value) { tree: res.data
ElMessage.warning('请输入密码') })
})
deviceRestartLoading.value = false }
} else { //装置重启
passwordConfirm(value) const deviceRestartLoading = ref<boolean>(false)
.then((resp: any) => { const handleRestartDevice = () => {
if (resp.code == 'A0000') { deviceRestartLoading.value = true
reStartDevice({ nDid: nDid.value }).then((res: any) => { ElMessageBox.prompt('二次校验密码确认', '装置重启', {
deviceRestartLoading.value = false confirmButtonText: '确认',
ElMessage({ message: res.message, type: 'success', duration: 3000 }) cancelButtonText: '取消',
customClass: 'customInput',
}).catch(e => { inputType: 'text',
beforeClose: (action, instance, done) => {
deviceRestartLoading.value = false if (action === 'confirm') {
}) if (instance.inputValue == null) {
} return ElMessage.warning('请输入密码')
}) } else if (instance.inputValue?.length > 32) {
.catch(e => { return ElMessage.warning('密码长度不能超过32位,当前密码长度为' + instance.inputValue.length)
} else {
deviceRestartLoading.value = false done()
}) }
} } else {
}) done()
.catch(() => { }
deviceRestartLoading.value = false }
}) })
} .then(({ value }) => {
const exportData = () => { if (!value) {
ElMessage.warning('请输入密码')
xTableRef.value.exportData({ deviceRestartLoading.value = false
filename: deviceData.value.dataSetList.filter((item: any) => item.id == dataSet.value)[0]?.name, // 文件名字 } else {
sheetName: 'Sheet1', passwordConfirm(value)
type: 'xlsx', //导出文件类型 xlsx 和 csv .then((resp: any) => {
useStyle: true, if (resp.code == 'A0000') {
download: false, reStartDevice({ nDid: nDid.value })
data: tableData.value, // 数据源 // 过滤那个字段导出 .then((res: any) => {
columnFilterMethod: function (column, $columnIndex) { deviceRestartLoading.value = false
return !(column.$columnIndex === 0) ElMessage({ message: res.message, type: 'success', duration: 3000 })
} })
}) .catch(e => {
} deviceRestartLoading.value = false
</script> })
}
<style lang="scss"> })
.device-manage { .catch(e => {
display: flex; deviceRestartLoading.value = false
})
&-left { }
width: 280px; })
} .catch(() => {
deviceRestartLoading.value = false
&-right { })
overflow: hidden; }
flex: 1; const exportData = () => {
padding: 10px 10px 10px 0; xTableRef.value.exportData({
filename: deviceData.value.dataSetList.filter((item: any) => item.id == dataSet.value)[0]?.name, // 文件名字
.el-descriptions__header { sheetName: 'Sheet1',
height: 36px; type: 'xlsx', //导出文件类型 xlsx 和 csv
margin-bottom: 7px; useStyle: true,
display: flex; download: false,
align-items: center; data: tableData.value, // 数据源 // 过滤那个字段导出
} columnFilterMethod: function (column, $columnIndex) {
} return !(column.$columnIndex === 0)
} }
})
.customInput { }
.el-input__inner { </script>
-webkit-text-security: disc !important;
} <style lang="scss">
} .device-manage {
display: flex;
.export-btn {
position: absolute; &-left {
top: 4px; width: 280px;
right: 10px; }
z-index: 10;
} &-right {
</style> overflow: hidden;
flex: 1;
padding: 10px 10px 10px 0;
.el-descriptions__header {
height: 36px;
margin-bottom: 7px;
display: flex;
align-items: center;
}
}
}
.customInput {
.el-input__inner {
-webkit-text-security: disc !important;
}
}
.export-btn {
position: absolute;
top: 4px;
right: 10px;
z-index: 10;
}
</style>

View File

@@ -3,7 +3,7 @@
<OfficialUserTree @node-click="selectUser" @selectUser="selectUser"></OfficialUserTree> <OfficialUserTree @node-click="selectUser" @selectUser="selectUser"></OfficialUserTree>
<div class="device-manage-right" :style="{ height: pageHeight.height }"> <div class="device-manage-right" :style="{ height: pageHeight.height }">
<div class="el-descriptions__header"> <div class="el-descriptions__header">
<el-button type="primary" @click="getEnginnerDev">添加工程 / 设备</el-button> <el-button type="primary" icon="el-icon-Sort" @click="getEnginnerDev">绑定工程 / 设备</el-button>
</div> </div>
<!-- 使用flex布局平均分配高度 --> <!-- 使用flex布局平均分配高度 -->
@@ -40,7 +40,8 @@
<!-- 对话框为左右布局 --> <!-- 对话框为左右布局 -->
<el-dialog <el-dialog
v-model.trim="dialogVisible" v-model.trim="dialogVisible"
title="添加工程 / 设备" draggable
title="绑定工程 / 设备"
class="cn-operate-dialog" class="cn-operate-dialog"
:close-on-click-modal="false" :close-on-click-modal="false"

View File

@@ -14,6 +14,9 @@ import Disposition from '@/views/govern/device/disposition/index.vue'
import OfficialUser from '@/views/govern/device/officialUser/index.vue' import OfficialUser from '@/views/govern/device/officialUser/index.vue'
import Tourist from '@/views/govern/device/tourist/index.vue' import Tourist from '@/views/govern/device/tourist/index.vue'
const activeName = ref('1') const activeName = ref('1')
defineOptions({
name: 'permission'
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep(.el-tabs--border-card > .el-tabs__content) { :deep(.el-tabs--border-card > .el-tabs__content) {

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<Table ref="tableRef" v-if="!isWaveCharts" /> <Table ref="tableRef" v-show="!isWaveCharts" />
<waveFormAnalysis v-loading="loading" v-if="isWaveCharts" ref="waveFormAnalysisRef" <waveFormAnalysis v-loading="loading" v-if="isWaveCharts" ref="waveFormAnalysisRef"
@handleHideCharts="isWaveCharts = false" :wp="wp" /> @handleHideCharts="isWaveCharts = false" :wp="wp" />
</div> </div>
@@ -77,10 +77,10 @@ const tableStore = new TableStore({
}, sortable: true }, sortable: true
}, },
{ {
title: '操作', title: '操作', fixed: 'right',
width: 180, width: 180,
render: 'buttons', render: 'buttons',
fixed: 'right',
buttons: [ buttons: [
{ {
name: 'edit', name: 'edit',

View File

@@ -83,12 +83,12 @@
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="起始时间" width="160"> <el-descriptions-item label="起始时间" width="160">
<span style="width: 140px; overflow: hidden; display: block"> <span style="width: 140px; overflow: hidden; display: block">
{{ item.startTime }} {{ item.startTime ||'/' }}
</span> </span>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="结束时间" width="160"> <el-descriptions-item label="结束时间" width="160">
<span style="width: 140px; overflow: hidden; display: block"> <span style="width: 140px; overflow: hidden; display: block">
{{ item.endTime }} {{ item.endTime||'/' }}
</span> </span>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="监测位置" width="160"> <el-descriptions-item label="监测位置" width="160">
@@ -120,7 +120,8 @@
<template v-slot:select :key="num"> <template v-slot:select :key="num">
<el-form-item for="-" label="统计指标"> <el-form-item for="-" label="统计指标">
<el-select <el-select
style="min-width: 200px" style="min-width: 240px"
filterable
collapse-tags collapse-tags
collapse-tags-tooltip collapse-tags-tooltip
v-model.trim="searchForm.index" v-model.trim="searchForm.index"
@@ -266,6 +267,11 @@ const dictData = useDictData()
defineOptions({ defineOptions({
// name: 'govern/device/planData/index' // name: 'govern/device/planData/index'
}) })
const props = defineProps({
TrendList: {
type: Array
}
})
const childTab = ref('0') const childTab = ref('0')
const num = ref(0) const num = ref(0)
const config = useConfig() const config = useConfig()
@@ -313,53 +319,60 @@ const countOptions: any = ref([])
// Harmonic_Type // Harmonic_Type
// portable-harmonic // portable-harmonic
const legendDictList: any = ref([]) const legendDictList: any = ref([])
queryByCode('portable-harmonic').then(res => { // queryByCode('portable-harmonic').then(res => {
queryCsDictTree(res.data.id).then(item => { const getCode = (conType: string) => {
indexOptions.value = item.data.sort((a: any, b: any) => { let code = volConTypeList.find(vv => {
return a.sort - b.sort return vv.id == conType
})?.code
queryByCode(code == 'Star_Triangle' ? 'portable-harmonic-jx' : 'portable-harmonic').then(res => {
queryCsDictTree(res.data.id).then(item => {
indexOptions.value = item.data.sort((a: any, b: any) => {
return a.sort - b.sort
})
searchForm.value.index[0] = indexOptions.value[0].id
// searchForm.value.index = indexOptions.value[0].id
}) })
searchForm.value.index[0] = indexOptions.value[0].id queryStatistical(res.data.id).then(vv => {
// searchForm.value.index = indexOptions.value[0].id legendDictList.value = vv.data
}) indexOptions.value.map((item: any, index: any) => {
queryStatistical(res.data.id).then(vv => { if (!countDataCopy.value[index]) {
legendDictList.value = vv.data countDataCopy.value[index] = {
indexOptions.value.map((item: any, index: any) => { index: item.id,
if (!countDataCopy.value[index]) { countOptions: [],
countDataCopy.value[index] = { count: [],
index: item.id, name: indexOptions.value.find((vv: any) => {
countOptions: [], return vv.id == item.id
count: [], })?.name
name: indexOptions.value.find((vv: any) => { }
return vv.id == item.id
})?.name
} }
} legendDictList.value?.selectedList?.map((vv: any, vvs: any) => {
legendDictList.value?.selectedList?.map((vv: any, vvs: any) => { //查找相等的指标
//查找相等的指标 if (item.id == vv.dataType) {
if (item.id == vv.dataType) { vv.eleEpdPqdVOS.map((kk: any, kks: any) => {
vv.eleEpdPqdVOS.map((kk: any, kks: any) => { if (kk.harmStart && kk.harmEnd) {
if (kk.harmStart && kk.harmEnd) { range(0, 0, 0)
range(0, 0, 0)
if (kk.showName == '间谐波电压含有率') { // if (kk.showName == '间谐波电压含有率') {
countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1).map( // countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1).map(
(item: any) => { // (item: any) => {
return item - 0.5 // return item - 0.5
} // }
) // )
} else { // } else {
countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1) countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1)
// }
if (!countDataCopy.value[index].count || countDataCopy.value[index].count.length == 0) {
countDataCopy.value[index].count = countDataCopy.value[index].countOptions[0]
}
} }
if (!countDataCopy.value[index].count || countDataCopy.value[index].count.length == 0) { })
countDataCopy.value[index].count = countDataCopy.value[index].countOptions[0] }
} })
}
})
}
}) })
}) })
}) })
}) }
// getCode(1)
const activeName: any = ref() const activeName: any = ref()
const activeColName: any = ref('0') const activeColName: any = ref('0')
const deviceData: any = ref([]) const deviceData: any = ref([])
@@ -368,11 +381,15 @@ const schemeTreeRef = ref()
const historyDevId: any = ref('') const historyDevId: any = ref('')
const chartTitle: any = ref('') const chartTitle: any = ref('')
//点击测试项切换树节点 //点击测试项切换树节点
const handleClickTabs = () => { const handleClickTabs = async () => {
searchForm.value.index = [indexOptions.value[0].id] await getCode(deviceData.value.records.filter(item => item.id == activeName.value)[0].volConType)
historyDevId.value = activeName.value await setTimeout(() => {
schemeTreeRef.value.setCheckedNode(activeName.value) searchForm.value.index = [indexOptions.value[0].id]
setTimeout(() => { historyDevId.value = activeName.value
schemeTreeRef.value.setCheckedNode(activeName.value)
}, 100)
await setTimeout(() => {
init(true) init(true)
transientRef.value && transientRef.value.init() transientRef.value && transientRef.value.init()
}, 100) }, 100)
@@ -391,6 +408,7 @@ const nodeClick = async (e: anyObj) => {
await getTestRecordInfo(id) await getTestRecordInfo(id)
.then(async res => { .then(async res => {
deviceData.value = res.data deviceData.value = res.data
if (res.data.records.length == 1) { if (res.data.records.length == 1) {
activeName.value = res.data.records[0].id activeName.value = res.data.records[0].id
} else { } else {
@@ -406,6 +424,7 @@ const nodeClick = async (e: anyObj) => {
activeName.value = res.data.records[0].id activeName.value = res.data.records[0].id
} }
} }
getCode(deviceData.value.records.filter(item => item.id == activeName.value)[0].volConType)
// if (searchForm.value.index.length == 0) { // if (searchForm.value.index.length == 0) {
// searchForm.value.index = [indexOptions.value[0].id] // searchForm.value.index = [indexOptions.value[0].id]
@@ -498,7 +517,7 @@ const range = (start: any, end: any, step: any) => {
const colors = ['#DAA520', '#2E8B57', '#A52a2a'] const colors = ['#DAA520', '#2E8B57', '#A52a2a']
const lineStyle = [{ type: 'solid' }, { type: 'dashed' }, { type: 'dotted' }] const lineStyle = [{ type: 'solid' }, { type: 'dashed' }, { type: 'dotted' }]
const titleList: any = ref('') const titleList: any = ref('(未绑定数据)')
const init = (flag: boolean) => { const init = (flag: boolean) => {
titleList.value = '' titleList.value = ''
let list: any = [] let list: any = []
@@ -547,7 +566,7 @@ const init = (flag: boolean) => {
let frequencys: any = null let frequencys: any = null
countData.value.map((item: any, index: any) => { countData.value.map((item: any, index: any) => {
if (item.name.includes('间谐波电压')) { if (item.name.includes('间谐波电压')) {
frequencys = item.count + 0.5 frequencys = item.count //+ 0.5
} else { } else {
frequencys = item.count frequencys = item.count
} }
@@ -574,6 +593,8 @@ const init = (flag: boolean) => {
}).then(res => { }).then(res => {
if (res.data.length == 0) { if (res.data.length == 0) {
titleList.value = '(未绑定数据)' titleList.value = '(未绑定数据)'
} else {
titleList.value = ''
} }
chartTitle.value = chartTitle.value + titleList.value chartTitle.value = chartTitle.value + titleList.value
}) })

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