3 Commits

Author SHA1 Message Date
guanj
120892808b 提交代码 2026-04-25 15:21:53 +08:00
guanj
0f5cb1d3c5 提交代码 2026-04-09 11:44:06 +08:00
cdf
dbaa42ff7e 通用台账查询页面调整 2026-04-09 11:42:54 +08:00
18 changed files with 1554 additions and 1402 deletions

View File

@@ -13,9 +13,11 @@ onMounted(async () => {
const response = await fetch('/') const response = await fetch('/')
const WebSocketUrl:any = response.headers.get('X-WebSocket-Url') const WebSocketUrl:any = response.headers.get('X-WebSocket-Url')
const WebSocketUrl2:any = response.headers.get('X-WebSocket-Url2') const WebSocketUrl2:any = response.headers.get('X-WebSocket-Url2')
const WebSocketUrl3:any = response.headers.get('X-WebSocket-Url3')
const MqttUrl:any = response.headers.get('X-MqttUrl-Url') const MqttUrl:any = response.headers.get('X-MqttUrl-Url')
localStorage.setItem('WebSocketUrl2', WebSocketUrl2)
localStorage.setItem('WebSocketUrl', WebSocketUrl) localStorage.setItem('WebSocketUrl', WebSocketUrl)
localStorage.setItem('WebSocketUrl2', WebSocketUrl2)
localStorage.setItem('WebSocketUrl3', WebSocketUrl3)
localStorage.setItem('MqttUrl', MqttUrl) localStorage.setItem('MqttUrl', MqttUrl)
}) })
</script> </script>

View File

@@ -23,7 +23,7 @@
</el-form-item> </el-form-item>
<el-form-item label="区域" v-if="area"> <el-form-item label="区域" v-if="area">
<Area ref="areaRef" v-model="tableStore.table.params.deptIndex" @change-value="onAreaChange" /> <Area ref="areaRef" v-model="tableStore.table.params.deptIndex" @change-value="onAreaChange" />
</el-form-item> </el-form-item>
<slot name="select"></slot> <slot name="select"></slot>
</el-form> </el-form>
@@ -81,7 +81,7 @@ import { mainHeight } from '@/utils/layout'
import { useDictData } from '@/stores/dictData' import { useDictData } from '@/stores/dictData'
import { Search, RefreshLeft } from '@element-plus/icons-vue' import { Search, RefreshLeft } from '@element-plus/icons-vue'
import { defineProps } from 'vue' import { defineProps } from 'vue'
const emit = defineEmits(['selectChange','areaChange']) const emit = defineEmits(['selectChange', 'areaChange'])
const tableStore = inject('tableStore') as TableStore const tableStore = inject('tableStore') as TableStore
const tableHeader = ref() const tableHeader = ref()
const datePickerRef = ref() const datePickerRef = ref()
@@ -132,9 +132,8 @@ const headerFormSecondStyleClose = {
padding: '0' padding: '0'
} }
const onAreaChange = (data) => { const onAreaChange = data => {
emit('areaChange', { label: data.label })
emit('areaChange', {label: data.label})
} }
watch( watch(
@@ -142,7 +141,6 @@ watch(
newVal => { newVal => {
setTimeout(() => { setTimeout(() => {
areaRef.value && areaRef.value.change() areaRef.value && areaRef.value.change()
}, 0) }, 0)
} }
) )
@@ -238,14 +236,14 @@ const onResetForm = () => {
//时间重置成默认值 //时间重置成默认值
datePickerRef.value?.setTheDate(3) datePickerRef.value?.setTheDate(3)
if(props.showTimeAll){ if (props.showTimeAll) {
timeAll.value = false timeAll.value = false
delete tableStore.table.params.searchBeginTime delete tableStore.table.params.searchBeginTime
delete tableStore.table.params.searchEndTime delete tableStore.table.params.searchEndTime
delete tableStore.table.params.startTime delete tableStore.table.params.startTime
delete tableStore.table.params.endTime delete tableStore.table.params.endTime
delete tableStore.table.params.timeFlag delete tableStore.table.params.timeFlag
delete tableStore.table.params.interval delete tableStore.table.params.interval
} }
if (props.datePicker && timeAll.value) { if (props.datePicker && timeAll.value) {
@@ -264,7 +262,6 @@ const setTheDate = (val: any) => {
} }
// 导出 // 导出
const onExport = () => { const onExport = () => {
tableStore.onTableAction('export', { showAllFlag: true }) tableStore.onTableAction('export', { showAllFlag: true })
} }

View File

@@ -50,7 +50,8 @@ import { ref, reactive, onMounted } from 'vue'
import { defaultAttribute } from '@/components/table/defaultAttribute' import { defaultAttribute } from '@/components/table/defaultAttribute'
import { mainHeight } from '@/utils/layout' import { mainHeight } from '@/utils/layout'
import { useDictData } from '@/stores/dictData' import { useDictData } from '@/stores/dictData'
import MQTT from '@/utils/mqtt' // import MQTT from '@/utils/mqtt'
import socketClient from '@/utils/webSocketClient'
const dictData = useDictData() const dictData = useDictData()
const event = dictData.getBasicData('Event_Statis') const event = dictData.getBasicData('Event_Statis')
import { useAdminInfo } from '@/stores/adminInfo' import { useAdminInfo } from '@/stores/adminInfo'
@@ -68,37 +69,72 @@ const handleClose = (done: any) => {
drawer.value = false drawer.value = false
done() done()
} }
const init = async () => { const dataSocket = reactive({
const mqttClient = new MQTT('/sendEvent') socketServe: socketClient.Instance
// 设置消息接收回调 })
try { // const init = async () => {
await mqttClient.init() // const mqttClient = new MQTT('/sendEvent')
// // 设置消息接收回调
// try {
// await mqttClient.init()
// 订阅主题 // // 订阅主题
await mqttClient.subscribe() // await mqttClient.subscribe()
// 设置消息接收回调 // // 设置消息接收回调
mqttClient.onMessage((topic, message) => { // mqttClient.onMessage((topic, message) => {
const msg = JSON.parse(message.toString()) // const msg = JSON.parse(message.toString())
// console.log('🚀 ~ init ~ msg:', msg) // // console.log('🚀 ~ init ~ msg:', msg)
if (msg.deptList.includes(adminInfo.$state.deptId)) { // if (msg.deptList.includes(adminInfo.$state.deptId)) {
drawer.value = true // drawer.value = true
isLoading.value = true // isLoading.value = true
eventList.value.unshift(msg) // eventList.value.unshift(msg)
setTimeout(() => { // setTimeout(() => {
isLoading.value = false // isLoading.value = false
}, 500) // }, 500)
} // }
}) // })
} catch (error) { // } catch (error) {
// console.error('MQTT 初始化失败:', error) // // console.error('MQTT 初始化失败:', error)
} // }
// }
const socket = async () => {
const url = localStorage.getItem('WebSocketUrl3') || 'null' //'ws://192.168.2.130:10203/event/'
// const url = 'ws://192.168.1.68:10203/event/'
await dataSocket.socketServe.connect(`${url}${adminInfo.id}`)
await dataSocket.socketServe.registerCallBack('message', (res: any) => {
if (res.deptList.includes(adminInfo.$state.deptId)) {
drawer.value = true
isLoading.value = true
eventList.value.unshift(res)
setTimeout(() => {
isLoading.value = false
}, 500)
}
// logList.value.push({
// type: res.code == 500 ? 'error' : '',
// time: formatDate(new Date(), 'YYYY-MM-DD hh:mm:ss'),
// name: res.message
// })
})
} }
onUnmounted(() => {
dataSocket.socketServe?.closeWs()
})
onMounted(() => { onMounted(() => {
// startMqtt('/sendEvent', (topic, message) => { // startMqtt('/sendEvent', (topic, message) => {
// const msg = JSON.parse(message.toString()) // const msg = JSON.parse(message.toString())
// console.log(msg) // console.log(msg)
// }) // })
init()
setTimeout(() => {
socket()
}, 3000)
}) })
defineExpose({ defineExpose({
open, open,

View File

@@ -11,6 +11,7 @@ const calculateValue = (o: number, value: number, num: number, isMin: boolean) =
} else if (value > -1 && value < 0 && isMin == false) { } else if (value > -1 && value < 0 && isMin == false) {
return 0 return 0
} }
let base let base
if (Math.abs(o) >= 100) { if (Math.abs(o) >= 100) {
base = 100 base = 100
@@ -19,8 +20,11 @@ const calculateValue = (o: number, value: number, num: number, isMin: boolean) =
} else if (Math.abs(o) >= 1) { } else if (Math.abs(o) >= 1) {
base = 1 base = 1
} else { } else {
base = 0.1 const multiple = 1 / 0.1
base = Math.ceil(Math.abs(o) * multiple) / multiple
} }
let calculatedValue let calculatedValue
if (isMin) { if (isMin) {
if (value < 0) { if (value < 0) {
@@ -35,18 +39,19 @@ const calculateValue = (o: number, value: number, num: number, isMin: boolean) =
calculatedValue = value + num * value calculatedValue = value + num * value
} }
} }
if (base === 0.1) { if (base === 0.1) {
return parseFloat(calculatedValue.toFixed(1)) // return parseFloat(calculatedValue.toFixed(1))
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 {
return Math.ceil(calculatedValue / base) * base return Math.ceil(calculatedValue / base) * base
} }
} }
// 处理y轴最大最小值 // 处理y轴最大最小值
export const yMethod = (arr: any) => { export const yMethod = (arr: any) => {
let num = 0.1 let num = 0.2
let numList = dataProcessing(arr) let numList = dataProcessing(arr)
let maxValue = 0 let maxValue = 0
let minValue = 0 let minValue = 0
@@ -54,12 +59,9 @@ export const yMethod = (arr: any) => {
let min = 0 let min = 0
maxValue = Math.max(...numList) maxValue = Math.max(...numList)
minValue = Math.min(...numList) minValue = Math.min(...numList)
const o = maxValue - minValue const o = maxValue - minValue == 0 ? maxValue : maxValue - minValue
if (Math.abs(o) >= 300) {
num = 0.02
}
min = calculateValue(o, minValue, num, true) min = calculateValue(o, minValue, num, true)
max = calculateValue(o, maxValue, num, false) max = calculateValue(o, maxValue, num, false)
// if (-100 >= minValue) { // if (-100 >= minValue) {
// min = Math.floor((minValue + num * minValue) / 100) * 100 // min = Math.floor((minValue + num * minValue) / 100) * 100
@@ -158,8 +160,6 @@ export const exportCSV = (title: object, data: any, filename: string) => {
URL.revokeObjectURL(link.href) URL.revokeObjectURL(link.href)
} }
/** /**
* 补全时间序列数据中缺失的条目 * 补全时间序列数据中缺失的条目
* @param rawData 原始数据,格式为 [["时间字符串", "数值", "单位", "类型"], ...] * @param rawData 原始数据,格式为 [["时间字符串", "数值", "单位", "类型"], ...]

View File

@@ -1,400 +1,432 @@
interface TreeHelperConfig { interface TreeHelperConfig {
id: string id: string
children: string children: string
pid: string pid: string
} }
const DEFAULT_CONFIG: TreeHelperConfig = { const DEFAULT_CONFIG: TreeHelperConfig = {
id: 'id', id: 'id',
children: 'children', children: 'children',
pid: 'pid' pid: 'pid'
} }
export const defaultProps = { export const defaultProps = {
children: 'children', children: 'children',
label: 'name', label: 'name',
value: 'id', value: 'id',
isLeaf: 'leaf', isLeaf: 'leaf',
emitPath: false // 用于 cascader 组件:在选中节点改变时,是否返回由该节点所在的各级菜单的值所组成的数组,若设置 false则只返回该节点的值 emitPath: false // 用于 cascader 组件:在选中节点改变时,是否返回由该节点所在的各级菜单的值所组成的数组,若设置 false则只返回该节点的值
} }
const getConfig = (config: Partial<TreeHelperConfig>) => Object.assign({}, DEFAULT_CONFIG, config) const getConfig = (config: Partial<TreeHelperConfig>) => Object.assign({}, DEFAULT_CONFIG, config)
// tree from list // tree from list
export const listToTree = <T = any>(list: any[], config: Partial<TreeHelperConfig> = {}): T[] => { export const listToTree = <T = any>(list: any[], config: Partial<TreeHelperConfig> = {}): T[] => {
const conf = getConfig(config) as TreeHelperConfig const conf = getConfig(config) as TreeHelperConfig
const nodeMap = new Map() const nodeMap = new Map()
const result: T[] = [] const result: T[] = []
const { id, children, pid } = conf const { id, children, pid } = conf
for (const node of list) { for (const node of list) {
node[children] = node[children] || [] node[children] = node[children] || []
nodeMap.set(node[id], node) nodeMap.set(node[id], node)
} }
for (const node of list) { for (const node of list) {
const parent = nodeMap.get(node[pid]) const parent = nodeMap.get(node[pid])
;(parent ? parent.children : result).push(node) ;(parent ? parent.children : result).push(node)
} }
return result return result
} }
export const treeToList = <T = any>(tree: any, config: Partial<TreeHelperConfig> = {}): T => { export const treeToList = <T = any>(tree: any, config: Partial<TreeHelperConfig> = {}): T => {
config = getConfig(config) config = getConfig(config)
const { children } = config const { children } = config
const result: any = [...tree] const result: any = [...tree]
for (let i = 0; i < result.length; i++) { for (let i = 0; i < result.length; i++) {
if (!result[i][children!]) continue if (!result[i][children!]) continue
result.splice(i + 1, 0, ...result[i][children!]) result.splice(i + 1, 0, ...result[i][children!])
} }
return result return result
} }
export const findNode = <T = any>( export const findNode = <T = any>(
tree: any, tree: any,
func: Fn, func: Fn,
config: Partial<TreeHelperConfig> = {} config: Partial<TreeHelperConfig> = {}
): T | null => { ): T | null => {
config = getConfig(config) config = getConfig(config)
const { children } = config const { children } = config
const list = [...tree] const list = [...tree]
for (const node of list) { for (const node of list) {
if (func(node)) return node if (func(node)) return node
node[children!] && list.push(...node[children!]) node[children!] && list.push(...node[children!])
} }
return null return null
} }
export const findNodeAll = <T = any>( export const findNodeAll = <T = any>(
tree: any, tree: any,
func: Fn, func: Fn,
config: Partial<TreeHelperConfig> = {} config: Partial<TreeHelperConfig> = {}
): T[] => { ): T[] => {
config = getConfig(config) config = getConfig(config)
const { children } = config const { children } = config
const list = [...tree] const list = [...tree]
const result: T[] = [] const result: T[] = []
for (const node of list) { for (const node of list) {
func(node) && result.push(node) func(node) && result.push(node)
node[children!] && list.push(...node[children!]) node[children!] && list.push(...node[children!])
} }
return result return result
} }
export const findPath = <T = any>( export const findPath = <T = any>(
tree: any, tree: any,
func: Fn, func: Fn,
config: Partial<TreeHelperConfig> = {} config: Partial<TreeHelperConfig> = {}
): T | T[] | null => { ): T | T[] | null => {
config = getConfig(config) config = getConfig(config)
const path: T[] = [] const path: T[] = []
const list = [...tree] const list = [...tree]
const visitedSet = new Set() const visitedSet = new Set()
const { children } = config const { children } = config
while (list.length) { while (list.length) {
const node = list[0] const node = list[0]
if (visitedSet.has(node)) { if (visitedSet.has(node)) {
path.pop() path.pop()
list.shift() list.shift()
} else { } else {
visitedSet.add(node) visitedSet.add(node)
node[children!] && list.unshift(...node[children!]) node[children!] && list.unshift(...node[children!])
path.push(node) path.push(node)
if (func(node)) { if (func(node)) {
return path return path
} }
} }
} }
return null return null
} }
export const findPathAll = (tree: any, func: Fn, config: Partial<TreeHelperConfig> = {}) => { export const findPathAll = (tree: any, func: Fn, config: Partial<TreeHelperConfig> = {}) => {
config = getConfig(config) config = getConfig(config)
const path: any[] = [] const path: any[] = []
const list = [...tree] const list = [...tree]
const result: any[] = [] const result: any[] = []
const visitedSet = new Set(), const visitedSet = new Set(),
{ children } = config { children } = config
while (list.length) { while (list.length) {
const node = list[0] const node = list[0]
if (visitedSet.has(node)) { if (visitedSet.has(node)) {
path.pop() path.pop()
list.shift() list.shift()
} else { } else {
visitedSet.add(node) visitedSet.add(node)
node[children!] && list.unshift(...node[children!]) node[children!] && list.unshift(...node[children!])
path.push(node) path.push(node)
func(node) && result.push([...path]) func(node) && result.push([...path])
} }
} }
return result return result
} }
export const filter = <T = any>( export const filter = <T = any>(
tree: T[], tree: T[],
func: (n: T) => boolean, func: (n: T) => boolean,
config: Partial<TreeHelperConfig> = {} config: Partial<TreeHelperConfig> = {}
): T[] => { ): T[] => {
config = getConfig(config) config = getConfig(config)
const children = config.children as string const children = config.children as string
function listFilter(list: T[]) { function listFilter(list: T[]) {
return list return list
.map((node: any) => ({ ...node })) .map((node: any) => ({ ...node }))
.filter((node) => { .filter((node) => {
node[children] = node[children] && listFilter(node[children]) node[children] = node[children] && listFilter(node[children])
return func(node) || (node[children] && node[children].length) return func(node) || (node[children] && node[children].length)
}) })
} }
return listFilter(tree) return listFilter(tree)
} }
export const filterTree = <T = any>(
export const forEach = <T = any>( tree: T[],
tree: T[], func: (n: T) => boolean,
func: (n: T) => any, config: Partial<TreeHelperConfig> = {}
config: Partial<TreeHelperConfig> = {} ): T[] => {
): void => { config = getConfig(config)
config = getConfig(config) const children = config.children as string
const list: any[] = [...tree]
const { children } = config function listFilter(list: T[]) {
for (let i = 0; i < list.length; i++) { return list
// func 返回true就终止遍历避免大量节点场景下无意义循环引起浏览器卡顿 .map((node: any) => ({ ...node }))
if (func(list[i])) { .filter((node) => {
return // 1. 如果当前节点匹配 → 直接保留【所有子节点】,不再过滤下级
} if (func(node)) {
children && list[i][children] && list.splice(i + 1, 0, ...list[i][children]) return true;
} }
}
// 2. 如果当前节点不匹配,递归过滤子节点
/** if (node[children]) {
* @description: Extract tree specified structure const filteredChildren = listFilter(node[children]);
*/ if (filteredChildren.length > 0) {
export const treeMap = <T = any>( node[children] = filteredChildren;
treeData: T[], return true;
opt: { children?: string; conversion: Fn } }
): T[] => { }
return treeData.map((item) => treeMapEach(item, opt))
} // 3. 都不匹配,过滤掉
return false;
/** })
* @description: Extract tree specified structure }
*/
export const treeMapEach = ( return listFilter(tree)
data: any, }
{ children = 'children', conversion }: { children?: string; conversion: Fn } export const forEach = <T = any>(
) => { tree: T[],
const haveChildren = Array.isArray(data[children]) && data[children].length > 0 func: (n: T) => any,
const conversionData = conversion(data) || {} config: Partial<TreeHelperConfig> = {}
if (haveChildren) { ): void => {
return { config = getConfig(config)
...conversionData, const list: any[] = [...tree]
[children]: data[children].map((i: number) => const { children } = config
treeMapEach(i, { for (let i = 0; i < list.length; i++) {
children, // func 返回true就终止遍历避免大量节点场景下无意义循环引起浏览器卡顿
conversion if (func(list[i])) {
}) return
) }
} children && list[i][children] && list.splice(i + 1, 0, ...list[i][children])
} else { }
return { }
...conversionData
} /**
} * @description: Extract tree specified structure
} */
export const treeMap = <T = any>(
/** treeData: T[],
* 递归遍历树结构 opt: { children?: string; conversion: Fn }
* @param treeDatas 树 ): T[] => {
* @param callBack 回调 return treeData.map((item) => treeMapEach(item, opt))
* @param parentNode 父节点 }
*/
export const eachTree = (treeDatas: any[], callBack: Fn, parentNode = {}) => { /**
treeDatas.forEach((element) => { * @description: Extract tree specified structure
const newNode = callBack(element, parentNode) || element */
if (element.children) { export const treeMapEach = (
eachTree(element.children, callBack, newNode) data: any,
} { children = 'children', conversion }: { children?: string; conversion: Fn }
}) ) => {
} const haveChildren = Array.isArray(data[children]) && data[children].length > 0
const conversionData = conversion(data) || {}
/** if (haveChildren) {
* 构造树型结构数据 return {
* @param {*} data 数据源 ...conversionData,
* @param {*} id id字段 默认 'id' [children]: data[children].map((i: number) =>
* @param {*} parentId 父节点字段 默认 'parentId' treeMapEach(i, {
* @param {*} children 孩子节点字段 默认 'children' children,
*/ conversion
export const handleTree = (data: any[], id?: string, parentId?: string, children?: string) => { })
if (!Array.isArray(data)) { )
console.warn('data must be an array') }
return [] } else {
} return {
const config = { ...conversionData
id: id || 'id', }
parentId: parentId || 'parentId', }
childrenList: children || 'children' }
}
/**
const childrenListMap = {} * 递归遍历树结构
const nodeIds = {} * @param treeDatas 树
const tree: any[] = [] * @param callBack 回调
* @param parentNode 父节点
for (const d of data) { */
const parentId = d[config.parentId] export const eachTree = (treeDatas: any[], callBack: Fn, parentNode = {}) => {
if (childrenListMap[parentId] == null) { treeDatas.forEach((element) => {
childrenListMap[parentId] = [] const newNode = callBack(element, parentNode) || element
} if (element.children) {
nodeIds[d[config.id]] = d eachTree(element.children, callBack, newNode)
childrenListMap[parentId].push(d) }
} })
}
for (const d of data) {
const parentId = d[config.parentId] /**
if (nodeIds[parentId] == null) { * 构造树型结构数据
tree.push(d) * @param {*} data 数据源
} * @param {*} id id字段 默认 'id'
} * @param {*} parentId 父节点字段 默认 'parentId'
* @param {*} children 孩子节点字段 默认 'children'
for (const t of tree) { */
adaptToChildrenList(t) export const handleTree = (data: any[], id?: string, parentId?: string, children?: string) => {
} if (!Array.isArray(data)) {
console.warn('data must be an array')
function adaptToChildrenList(o) { return []
if (childrenListMap[o[config.id]] !== null) { }
o[config.childrenList] = childrenListMap[o[config.id]] const config = {
} id: id || 'id',
if (o[config.childrenList]) { parentId: parentId || 'parentId',
for (const c of o[config.childrenList]) { childrenList: children || 'children'
adaptToChildrenList(c) }
}
} const childrenListMap = {}
} const nodeIds = {}
const tree: any[] = []
return tree
} for (const d of data) {
const parentId = d[config.parentId]
/** if (childrenListMap[parentId] == null) {
* 构造树型结构数据 childrenListMap[parentId] = []
* @param {*} data 数据源 }
* @param {*} id id字段 默认 'id' nodeIds[d[config.id]] = d
* @param {*} parentId 父节点字段 默认 'parentId' childrenListMap[parentId].push(d)
* @param {*} children 孩子节点字段 默认 'children' }
* @param {*} rootId 根Id 默认 0
*/ for (const d of data) {
// @ts-ignore const parentId = d[config.parentId]
export const handleTree2 = (data, id, parentId, children, rootId) => { if (nodeIds[parentId] == null) {
id = id || 'id' tree.push(d)
parentId = parentId || 'parentId' }
// children = children || 'children' }
rootId =
rootId || for (const t of tree) {
Math.min( adaptToChildrenList(t)
...data.map((item) => { }
return item[parentId]
}) function adaptToChildrenList(o) {
) || if (childrenListMap[o[config.id]] !== null) {
0 o[config.childrenList] = childrenListMap[o[config.id]]
// 对源数据深度克隆 }
const cloneData = JSON.parse(JSON.stringify(data)) if (o[config.childrenList]) {
// 循环所有项 for (const c of o[config.childrenList]) {
const treeData = cloneData.filter((father) => { adaptToChildrenList(c)
const branchArr = cloneData.filter((child) => { }
// 返回每一项的子级数组 }
return father[id] === child[parentId] }
})
branchArr.length > 0 ? (father.children = branchArr) : '' return tree
// 返回第一层 }
return father[parentId] === rootId
}) /**
return treeData !== '' ? treeData : data * 构造树型结构数据
} * @param {*} data 数据源
* @param {*} id id字段 默认 'id'
/** * @param {*} parentId 父节点字段 默认 'parentId'
* 校验选中的节点,是否为指定 level * @param {*} children 孩子节点字段 默认 'children'
* * @param {*} rootId 根Id 默认 0
* @param tree 要操作的树结构数据 */
* @param nodeId 需要判断在什么层级的数据 // @ts-ignore
* @param level 检查的级别, 默认检查到二级 export const handleTree2 = (data, id, parentId, children, rootId) => {
* @return true 是false 否 id = id || 'id'
*/ parentId = parentId || 'parentId'
export const checkSelectedNode = (tree: any[], nodeId: any, level = 2): boolean => { // children = children || 'children'
if (typeof tree === 'undefined' || !Array.isArray(tree) || tree.length === 0) { rootId =
console.warn('tree must be an array') rootId ||
return false Math.min(
} ...data.map((item) => {
return item[parentId]
// 校验是否是一级节点 })
if (tree.some((item) => item.id === nodeId)) { ) ||
return false 0
} // 对源数据深度克隆
const cloneData = JSON.parse(JSON.stringify(data))
// 递归计数 // 循环所有项
let count = 1 const treeData = cloneData.filter((father) => {
const branchArr = cloneData.filter((child) => {
// 深层次校验 // 返回每一项的子级数组
function performAThoroughValidation(arr: any[]): boolean { return father[id] === child[parentId]
count += 1 })
for (const item of arr) { branchArr.length > 0 ? (father.children = branchArr) : ''
if (item.id === nodeId) { // 返回第一层
return true return father[parentId] === rootId
} else if (typeof item.children !== 'undefined' && item.children.length !== 0) { })
if (performAThoroughValidation(item.children)) { return treeData !== '' ? treeData : data
return true }
}
} /**
} * 校验选中的节点,是否为指定 level
return false *
} * @param tree 要操作的树结构数据
* @param nodeId 需要判断在什么层级的数据
for (const item of tree) { * @param level 检查的级别, 默认检查到二级
count = 1 * @return true 是false 否
if (performAThoroughValidation(item.children)) { */
// 找到后对比是否是期望的层级 export const checkSelectedNode = (tree: any[], nodeId: any, level = 2): boolean => {
if (count >= level) { if (typeof tree === 'undefined' || !Array.isArray(tree) || tree.length === 0) {
return true console.warn('tree must be an array')
} return false
} }
}
// 校验是否是一级节点
return false if (tree.some((item) => item.id === nodeId)) {
} return false
}
/**
* 获取节点的完整结构 // 递归计数
* @param tree 树数据 let count = 1
* @param nodeId 节点 id
*/ // 深层次校验
export const treeToString = (tree: any[], nodeId) => { function performAThoroughValidation(arr: any[]): boolean {
if (typeof tree === 'undefined' || !Array.isArray(tree) || tree.length === 0) { count += 1
console.warn('tree must be an array') for (const item of arr) {
return '' if (item.id === nodeId) {
} return true
// 校验是否是一级节点 } else if (typeof item.children !== 'undefined' && item.children.length !== 0) {
const node = tree.find((item) => item.id === nodeId) if (performAThoroughValidation(item.children)) {
if (typeof node !== 'undefined') { return true
return node.name }
} }
let str = '' }
return false
function performAThoroughValidation(arr) { }
for (const item of arr) {
if (item.id === nodeId) { for (const item of tree) {
str += ` / ${item.name}` count = 1
return true if (performAThoroughValidation(item.children)) {
} else if (typeof item.children !== 'undefined' && item.children.length !== 0) { // 找到后对比是否是期望的层级
str += ` / ${item.name}` if (count >= level) {
if (performAThoroughValidation(item.children)) { return true
return true }
} }
} }
}
return false return false
} }
for (const item of tree) { /**
str = `${item.name}` * 获取节点的完整结构
if (performAThoroughValidation(item.children)) { * @param tree 树数据
break * @param nodeId 节点 id
} */
} export const treeToString = (tree: any[], nodeId) => {
return str if (typeof tree === 'undefined' || !Array.isArray(tree) || tree.length === 0) {
} console.warn('tree must be an array')
return ''
}
// 校验是否是一级节点
const node = tree.find((item) => item.id === nodeId)
if (typeof node !== 'undefined') {
return node.name
}
let str = ''
function performAThoroughValidation(arr) {
for (const item of arr) {
if (item.id === nodeId) {
str += ` / ${item.name}`
return true
} else if (typeof item.children !== 'undefined' && item.children.length !== 0) {
str += ` / ${item.name}`
if (performAThoroughValidation(item.children)) {
return true
}
}
}
return false
}
for (const item of tree) {
str = `${item.name}`
if (performAThoroughValidation(item.children)) {
break
}
}
return str
}

View File

@@ -1,3 +1,4 @@
import { Flag } from '@element-plus/icons-vue/dist/types'
import { ElMessage, EVENT_CODE } from 'element-plus' import { ElMessage, EVENT_CODE } from 'element-plus'
// 定义消息类型,用于类型检查 // 定义消息类型,用于类型检查
@@ -43,13 +44,9 @@ export default class SocketService {
console.log('您的浏览器不支持WebSocket') console.log('您的浏览器不支持WebSocket')
return return
} }
if (url == 'null' || url == null) return
setTimeout(() => { setTimeout(() => {
// ws://192.168.1.69:10407/mgtt
// const url =
// (localStorage.getItem('WebSocketUrl') == 'null'
// ? 'ws://192.168.1.130:10405'
// : localStorage.getItem('WebSocketUrl')) + id
this.ws = new WebSocket(url) this.ws = new WebSocket(url)
this.ws.onopen = () => this.handleOpen() this.ws.onopen = () => this.handleOpen()
@@ -90,7 +87,7 @@ export default class SocketService {
if (event.data == '连接成功') { if (event.data == '连接成功') {
this.sendHeartbeat() this.sendHeartbeat()
} else if (event.data == 'connect') { } else if (event.data == 'over') {
} else if (event.data.length > 10) { } else if (event.data.length > 10) {
let message: MessageType let message: MessageType
try { try {
@@ -104,7 +101,7 @@ export default class SocketService {
// 通过接受服务端发送的type字段来回调函数 // 通过接受服务端发送的type字段来回调函数
if ((message.key || message.code) && this.callBackMapping['message']) { if ((message.key || message.code || message.time) && this.callBackMapping['message']) {
this.callBackMapping['message']!(message) this.callBackMapping['message']!(message)
} else { } else {
console.log('抛弃====>') console.log('抛弃====>')
@@ -112,6 +109,7 @@ export default class SocketService {
// 丢弃或继续写你的逻辑 // 丢弃或继续写你的逻辑
} }
} else { } else {
this.callBackMapping['message']!({ Flag: false })
ElMessage.error(event.data) ElMessage.error(event.data)
} }
} }

View File

@@ -1,274 +1,289 @@
<template> <template>
<div class="default-main online"> <div class="default-main online">
<div class="online_header"> <div class="online_header">
<TableHeader date-picker area ref="tableHeaderRef"> <TableHeader date-picker area ref="tableHeaderRef">
<template #select> <template #select>
<el-form-item label="统计类型:"> <el-form-item label="统计类型:">
<el-select <el-select
v-model="tableStore.table.params.statisticalType" v-model="tableStore.table.params.statisticalType"
placeholder="请选择统计类型" placeholder="请选择统计类型"
value-key="id" value-key="id"
style="width: 100%" style="width: 100%"
> >
<el-option <el-option
v-for="item in classificationData" v-for="item in classificationData"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item" :value="item"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="电压等级:"> <el-form-item label="电压等级:">
<el-select <el-select
v-model="tableStore.table.params.scale" v-model="tableStore.table.params.scale"
multiple multiple
collapse-tags collapse-tags
clearable clearable
placeholder="请选择电压等级" placeholder="请选择电压等级"
style="width: 100%" style="width: 100%"
value-key="id" value-key="id"
> >
<el-option <el-option
v-for="item in voltageleveloption" v-for="item in voltageleveloption"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item" :value="item"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="电网标识"> <el-form-item label="电网标识">
<el-select <el-select
v-model="tableStore.table.params.powerFlag" v-model="tableStore.table.params.powerFlag"
clearable clearable
style="width: 100%" style="width: 100%"
placeholder="请选择电网标识" placeholder="请选择电网标识"
> >
<el-option <el-option
v-for="item in powerFlagList" v-for="item in powerFlagList"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.algoDescribe" :value="item.algoDescribe"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="终端厂家:"> <el-form-item label="终端厂家:">
<el-select <el-select
v-model="tableStore.table.params.manufacturer" v-model="tableStore.table.params.manufacturer"
multiple multiple
collapse-tags collapse-tags
clearable clearable
placeholder="请选择终端厂家" placeholder="请选择终端厂家"
style="width: 100%" style="width: 100%"
value-key="id" value-key="id"
> >
<el-option <el-option
v-for="(item, index) in terminaloption" v-for="(item, index) in terminaloption"
:key="index" :key="index"
:label="item.name" :label="item.name"
:value="item" :value="item"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="干扰源类型:"> <el-form-item label="干扰源类型:">
<el-select <el-select
v-model="tableStore.table.params.loadType" v-model="tableStore.table.params.loadType"
multiple multiple
collapse-tags collapse-tags
clearable clearable
placeholder="请选择干扰源类型" placeholder="请选择干扰源类型"
style="width: 100%" style="width: 100%"
value-key="id" value-key="id"
> >
<el-option <el-option
v-for="(item, index) in interfereoption" v-for="(item, index) in interfereoption"
:key="index" :key="index"
:label="item.name" :label="item.name"
:value="item" :value="item"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> <el-form-item label="关键字筛选">
</TableHeader> <el-input
</div> v-model.trim="tableStore.table.params.searchValue"
<div class="online_main"> clearable
<el-tabs v-model="activeName" type="border-card" @tab-click="handleClick"> style="width: 200px"
<el-tab-pane :name="0" :lazy="true" label="稳态指标符合性占比表格"> placeholder="请输入关键字筛选"
<Table />
ref="tableRef" </el-form-item>
:tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }" </template>
:scroll-y="{ enabled: true }" </TableHeader>
v-if="activeName == 0" </div>
/> <div class="online_main">
</el-tab-pane> <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
<el-tab-pane :name="1" :lazy="true" label="稳态指标符合性占比"> <el-tab-pane :name="0" :lazy="true" label="稳态指标符合性占比表格">
<charts v-if="activeName == 1" ref="chartsRef" /> <Table
</el-tab-pane> ref="tableRef"
</el-tabs> :tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }"
</div> :scroll-y="{ enabled: true }"
</div> v-if="activeName == 0"
</template> />
<script lang="ts" setup> </el-tab-pane>
import { ref, onMounted, watch } from 'vue' <el-tab-pane :name="1" :lazy="true" label="稳态指标符合性占比图">
import { useDictData } from '@/stores/dictData' <charts v-if="activeName == 1" ref="chartsRef" />
import DatePicker from '@/components/form/datePicker/index.vue' </el-tab-pane>
import { getAreaDept } from '@/api/harmonic-boot/area' </el-tabs>
import TableHeader from '@/components/table/header/index.vue' </div>
import TableStore from '@/utils/tableStore' </div>
import Table from '@/components/table/index.vue' </template>
import charts from './components/charts.vue' <script lang="ts" setup>
defineOptions({ import { ref, onMounted, watch } from 'vue'
name: 'harmonic-boot/area/SteadyState' import { useDictData } from '@/stores/dictData'
}) import DatePicker from '@/components/form/datePicker/index.vue'
const tableRef = ref() import { getAreaDept } from '@/api/harmonic-boot/area'
const onlineChartsRef = ref() import TableHeader from '@/components/table/header/index.vue'
const dictData = useDictData() import TableStore from '@/utils/tableStore'
//字典获取电压等级 import Table from '@/components/table/index.vue'
const voltageleveloption = dictData.getBasicData('Dev_Voltage_Stand') import charts from './components/charts.vue'
//字典获取终端厂家 import { filterTree } from '@/utils/tree'
const terminaloption = dictData.getBasicData('Dev_Manufacturers') defineOptions({
//字典获取干扰源类型 name: 'harmonic-boot/area/SteadyState'
const interfereoption = dictData.getBasicData('Interference_Source') })
//字典获取统计类型 const tableRef = ref()
const classificationData = dictData.getBasicData('Statistical_Type', ['Report_Type']) const onlineChartsRef = ref()
//字典获取监督对象类型 const dictData = useDictData()
const powerFlagList = dictData.getBasicData('power_flag') //字典获取电压等级
//调用区域接口获取区域 const voltageleveloption = dictData.getBasicData('Dev_Voltage_Stand')
const treeData = ref([]) //字典获取终端厂家
const idArr = ref([]) const terminaloption = dictData.getBasicData('Dev_Manufacturers')
const activeName = ref(0) //字典获取干扰源类型
const getTreeData = async () => { const interfereoption = dictData.getBasicData('Interference_Source')
await getAreaDept().then(res => { //字典获取统计类型
var data = res.data const classificationData = dictData.getBasicData('Statistical_Type', ['Report_Type'])
data.forEach(element => { //字典获取监督对象类型
idArr.value.push(element.id) const powerFlagList = dictData.getBasicData('power_flag')
}) //调用区域接口获取区域
treeData.value = JSON.parse(JSON.stringify(res.data)) const treeData = ref([])
}) const idArr = ref([])
} const activeName = ref(0)
getTreeData() const getTreeData = async () => {
await getAreaDept().then(res => {
const chartsRef = ref() var data = res.data
const handleClick = (tab: any, e: any) => { data.forEach(element => {
// console.log(tab,e,"??????????"); idArr.value.push(element.id)
// if(activeName.value===1){ })
tableStore.index() treeData.value = JSON.parse(JSON.stringify(res.data))
// } })
} }
getTreeData()
// const datePickerRef = ref()
const tableHeaderRef = ref() const chartsRef = ref()
const tableStore = new TableStore({ const handleClick = (tab: any, e: any) => {
publicHeight: 60, // console.log(tab,e,"??????????");
showPage: false, // if(activeName.value===1){
url: '/harmonic-boot/steadyExceedRate/getSteadyExceedRateData', tableStore.index()
method: 'POST', // }
column: [ }
{
title: '', // const datePickerRef = ref()
field: 'name', const tableHeaderRef = ref()
align: 'left', const tableStore = new TableStore({
treeNode: true, publicHeight: 60,
width: 350 showPage: false,
}, url: '/harmonic-boot/steadyExceedRate/getSteadyExceedRateData',
{ method: 'POST',
title: '电压等级', column: [
field: 'voltageLevel', {
title: '',
formatter: function (row) { field: 'name',
return row.cellValue ? row.cellValue : '/' align: 'left',
} treeNode: true,
}, width: 350
{ },
title: '厂家', {
field: 'factoryName', title: '电压等级',
field: 'voltageLevel',
formatter: function (row) {
return row.cellValue ? row.cellValue : '/' formatter: function (row) {
} return row.cellValue ? row.cellValue : '/'
}, }
{ },
title: '网络参数', {
field: 'networkParam', title: '厂家',
field: 'factoryName',
formatter: function (row) {
return row.cellValue ? row.cellValue : '/' formatter: function (row) {
} return row.cellValue ? row.cellValue : '/'
}, }
{ },
title: '监测点名称', {
field: 'lineName', title: '网络参数',
field: 'networkParam',
formatter: function (row) {
return row.cellValue ? row.cellValue : '/' formatter: function (row) {
} return row.cellValue ? row.cellValue : '/'
}, }
{ },
title: '符合性占比(%)', {
field: 'steadyExceedRate', title: '监测点名称',
field: 'lineName',
formatter: function (row) {
return row.cellValue == 3.14159 ? '暂无数据' : row.cellValue formatter: function (row) {
} return row.cellValue ? row.cellValue : '/'
} }
], },
{
loadCallback: () => { title: '符合性占比(%)',
tableStore.table.data = tree2List(tableStore.table.data, Math.random() * 1000) field: 'steadyExceedRate',
tableStore.table.column[0].title = tableStore.table.params.statisticalType.name
formatter: function (row) {
chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params) return row.cellValue == 3.14159 ? '暂无数据' : row.cellValue
setTimeout(() => { }
activeName.value == 0 && tableRef.value && tableRef.value.getRef().setAllTreeExpand(true) }
}, 0) ],
}
}) loadCallback: () => {
tableStore.table.data = tree2List(
tableStore.table.params.statisticalType = classificationData[0] filterTree(tableStore.table.data, node => {
tableStore.table.params.scale = [] return node.name.includes(tableStore.table.params.searchValue)
tableStore.table.params.manufacturer = [] }),
tableStore.table.params.loadType = [] Math.random() * 1000
tableStore.table.params.powerFlag = 2 )
tableStore.table.params.serverName = 'harmonicBoot' tableStore.table.column[0].title = tableStore.table.params.statisticalType.name
provide('tableStore', tableStore)
const tree2List = (list: any, id?: string) => { chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params)
//存储结果的数组 setTimeout(() => {
let arr: any = [] activeName.value == 0 && tableRef.value && tableRef.value.getRef().setAllTreeExpand(true)
// 遍历 tree 数组 }, 0)
list.forEach((item: any) => { }
item.uPid = id })
item.uId = Math.random() * 1000
item.valueOver == 3.14159 ? 0 : item.valueOver >= 90 ? 1 : item.valueOver && item.valueOver < 90 ? 2 : 3 tableStore.table.params.statisticalType = classificationData[0]
// 判断item是否存在children tableStore.table.params.scale = []
if (!item.children) return arr.push(item) tableStore.table.params.manufacturer = []
// 函数递归对children数组进行tree2List的转换 tableStore.table.params.loadType = []
const children = tree2List(item.children, item.uId) tableStore.table.params.powerFlag = 2
// 删除item的children属性 tableStore.table.params.serverName = 'harmonicBoot'
delete item.children tableStore.table.params.searchValue = ''
// 把item和children数组添加至结果数组 provide('tableStore', tableStore)
//..children: 意思是把children数组展开 const tree2List = (list: any, id?: string) => {
arr.push(item, ...children) //存储结果的数组
}) let arr: any = []
// 返回结果数组 // 遍历 tree 数组
return arr list.forEach((item: any) => {
} item.uPid = id
item.uId = Math.random() * 1000
onMounted(() => { item.valueOver == 3.14159 ? 0 : item.valueOver >= 90 ? 1 : item.valueOver && item.valueOver < 90 ? 2 : 3
tableStore.index() // 判断item是否存在children
}) if (!item.children) return arr.push(item)
</script> // 函数递归对children数组进行tree2List的转换
<style lang="scss" scoped> const children = tree2List(item.children, item.uId)
// .online { // 删除item的children属性
// width: 100%; delete item.children
// height: 100%; // 把item和children数组添加至结果数组
// .online_header { //..children: 意思是把children数组展开
// width: 100%; arr.push(item, ...children)
// max-height: 140px; })
// padding: 10px; // 返回结果数组
// box-sizing: border-box; return arr
// } }
// .online_main {
// padding: 0 10px; onMounted(() => {
// } tableStore.index()
// } })
</style> </script>
<style lang="scss" scoped>
// .online {
// width: 100%;
// height: 100%;
// .online_header {
// width: 100%;
// max-height: 140px;
// padding: 10px;
// box-sizing: border-box;
// }
// .online_main {
// padding: 0 10px;
// }
// }
</style>

View File

@@ -473,7 +473,7 @@ const makeUpSubmit = () => {
logPopUp.value = true logPopUp.value = true
} }
const socket = async (form: any) => { const socket = async (form: any) => {
const url = (localStorage.getItem('WebSocketUrl2') || 'ws://192.168.1.67:10405/api/recell/') const url = (localStorage.getItem('WebSocketUrl2') || 'null')//'ws://192.168.1.67:10405/api/recell/')
logList.value = [] logList.value = []
await dataSocket.socketServe.connect(`${url}${adminInfo.id}`) await dataSocket.socketServe.connect(`${url}${adminInfo.id}`)
await dataSocket.socketServe.send(form) await dataSocket.socketServe.send(form)

View File

@@ -1,259 +1,275 @@
<template> <template>
<div class="default-main online"> <div class="default-main online">
<div class="online_header"> <div class="online_header">
<TableHeader date-picker area ref="tableHeaderRef"> <TableHeader date-picker area ref="tableHeaderRef">
<template #select> <template #select>
<el-form-item label="统计类型:"> <el-form-item label="统计类型:">
<el-select <el-select
v-model="tableStore.table.params.statisticalType" v-model="tableStore.table.params.statisticalType"
placeholder="请选择统计类型" placeholder="请选择统计类型"
value-key="id" value-key="id"
style="width: 100%" style="width: 100%"
> >
<el-option <el-option
v-for="item in classificationData" v-for="item in classificationData"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item" :value="item"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="电压等级:"> <el-form-item label="电压等级:">
<el-select <el-select
v-model="tableStore.table.params.scale" v-model="tableStore.table.params.scale"
multiple multiple
collapse-tags collapse-tags
clearable clearable
placeholder="请选择电压等级" placeholder="请选择电压等级"
style="width: 100%" style="width: 100%"
value-key="id" value-key="id"
> >
<el-option <el-option
v-for="item in voltageleveloption" v-for="item in voltageleveloption"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item" :value="item"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="终端厂家:"> <el-form-item label="终端厂家:">
<el-select <el-select
v-model="tableStore.table.params.manufacturer" v-model="tableStore.table.params.manufacturer"
multiple multiple
collapse-tags collapse-tags
clearable clearable
placeholder="请选择终端厂家" placeholder="请选择终端厂家"
style="width: 100%" style="width: 100%"
value-key="id" value-key="id"
> >
<el-option <el-option
v-for="(item, index) in terminaloption" v-for="(item, index) in terminaloption"
:key="index" :key="index"
:label="item.name" :label="item.name"
:value="item" :value="item"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="干扰源类型:"> <el-form-item label="干扰源类型:">
<el-select <el-select
v-model="tableStore.table.params.loadType" v-model="tableStore.table.params.loadType"
multiple multiple
collapse-tags collapse-tags
clearable clearable
placeholder="请选择干扰源类型" placeholder="请选择干扰源类型"
style="width: 100%" style="width: 100%"
value-key="id" value-key="id"
> >
<el-option <el-option
v-for="(item, index) in interfereoption" v-for="(item, index) in interfereoption"
:key="index" :key="index"
:label="item.name" :label="item.name"
:value="item" :value="item"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="电网标志"> <el-form-item label="电网标志">
<el-select v-model="tableStore.table.params.powerFlag" placeholder="请选择电网标志"> <el-select v-model="tableStore.table.params.powerFlag" placeholder="请选择电网标志">
<el-option <el-option
v-for="item in sign" v-for="item in sign"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.algoDescribe" :value="item.algoDescribe"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> <el-form-item label="关键字筛选">
</TableHeader> <el-input
</div> v-model.trim="tableStore.table.params.searchValue"
<div class="online_main"> clearable
<el-tabs v-model="activeName" type="border-card" @tab-click="handleClick"> style="width: 200px"
<el-tab-pane :name="0" :lazy="true" label="谐波畸变率统计表"> placeholder="请输入关键字筛选"
<Table />
ref="tableRef" </el-form-item>
:tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }" </template>
:scroll-y="{ enabled: true }" </TableHeader>
v-if="activeName == 0" </div>
/> <div class="online_main">
</el-tab-pane> <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
<el-tab-pane :name="1" :lazy="true" label="谐波畸变率统计"> <el-tab-pane :name="0" :lazy="true" label="谐波畸变率统计">
<charts v-if="activeName == 1" ref="chartsRef" /> <Table
</el-tab-pane> ref="tableRef"
</el-tabs> :tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }"
</div> :scroll-y="{ enabled: true }"
</div> v-if="activeName == 0"
</template> />
<script lang="ts" setup> </el-tab-pane>
import { ref, onMounted, watch } from 'vue' <el-tab-pane :name="1" :lazy="true" label="谐波畸变率统计图">
import { useDictData } from '@/stores/dictData' <charts v-if="activeName == 1" ref="chartsRef" />
import DatePicker from '@/components/form/datePicker/index.vue' </el-tab-pane>
import { getAreaDept } from '@/api/harmonic-boot/area' </el-tabs>
import TableHeader from '@/components/table/header/index.vue' </div>
import TableStore from '@/utils/tableStore' </div>
import Table from '@/components/table/index.vue' </template>
import charts from './components/charts.vue' <script lang="ts" setup>
defineOptions({ import { ref, onMounted, watch } from 'vue'
name: 'harmonic-boot/area/harmonicDistortionRate' import { useDictData } from '@/stores/dictData'
}) import DatePicker from '@/components/form/datePicker/index.vue'
const tableRef = ref() import { getAreaDept } from '@/api/harmonic-boot/area'
const onlineChartsRef = ref() import TableHeader from '@/components/table/header/index.vue'
const dictData = useDictData() import TableStore from '@/utils/tableStore'
//字典获取电压等级 import Table from '@/components/table/index.vue'
const voltageleveloption = dictData.getBasicData('Dev_Voltage_Stand') import charts from './components/charts.vue'
//字典获取终端厂家 import { filterTree } from '@/utils/tree'
const terminaloption = dictData.getBasicData('Dev_Manufacturers') defineOptions({
//字典获取干扰源类型 name: 'harmonic-boot/area/harmonicDistortionRate'
const interfereoption = dictData.getBasicData('Interference_Source') })
//字典获取统计类型 const tableRef = ref()
const classificationData = dictData.getBasicData('Statistical_Type', ['Report_Type']) const onlineChartsRef = ref()
//调用区域接口获取区域 const dictData = useDictData()
const sign = dictData.getBasicData('power_flag') //字典获取电压等级
const treeData = ref([]) const voltageleveloption = dictData.getBasicData('Dev_Voltage_Stand')
const idArr = ref([]) //字典获取终端厂家
const activeName = ref(0) const terminaloption = dictData.getBasicData('Dev_Manufacturers')
const getTreeData = async () => { //字典获取干扰源类型
await getAreaDept().then(res => { const interfereoption = dictData.getBasicData('Interference_Source')
var data = res.data //字典获取统计类型
data.forEach(element => { const classificationData = dictData.getBasicData('Statistical_Type', ['Report_Type'])
idArr.value.push(element.id) //调用区域接口获取区域
}) const sign = dictData.getBasicData('power_flag')
treeData.value = JSON.parse(JSON.stringify(res.data)) const treeData = ref([])
}) const idArr = ref([])
} const activeName = ref(0)
getTreeData() const getTreeData = async () => {
await getAreaDept().then(res => {
const chartsRef = ref() var data = res.data
const handleClick = (tab: any, e: any) => { data.forEach(element => {
// console.log(tab,e,"??????????"); idArr.value.push(element.id)
// if(activeName.value===1){ })
tableStore.index() treeData.value = JSON.parse(JSON.stringify(res.data))
// } })
} }
getTreeData()
// const datePickerRef = ref()
const tableHeaderRef = ref() const chartsRef = ref()
const tableStore = new TableStore({ const handleClick = (tab: any, e: any) => {
publicHeight: 60, // console.log(tab,e,"??????????");
showPage: false, // if(activeName.value===1){
url: '/harmonic-boot/tHDistortion/getTHDistortionData', tableStore.index()
method: 'POST', // }
column: [ }
{
title: '', // const datePickerRef = ref()
field: 'name', const tableHeaderRef = ref()
align: 'left', const tableStore = new TableStore({
treeNode: true, publicHeight: 60,
width: 350 showPage: false,
}, url: '/harmonic-boot/tHDistortion/getTHDistortionData',
{ method: 'POST',
title: '电压等级', column: [
field: 'voltageLevel', {
align: 'center', title: '',
formatter: function (row) { field: 'name',
return row.cellValue ? row.cellValue : '/' align: 'left',
} treeNode: true,
}, width: 350
{ },
title: '网络参数', {
field: 'networkParam', title: '电压等级',
align: 'center', field: 'voltageLevel',
formatter: function (row) { align: 'center',
return row.cellValue ? row.cellValue : '/' formatter: function (row) {
} return row.cellValue ? row.cellValue : '/'
}, }
{ },
title: '监测点名称', {
field: 'lineName', title: '网络参数',
align: 'center', field: 'networkParam',
formatter: function (row) { align: 'center',
return row.cellValue ? row.cellValue : '/' formatter: function (row) {
} return row.cellValue ? row.cellValue : '/'
}, }
{ },
title: '总谐波畸变率(%)', {
field: 'distortion', title: '监测点名称',
align: 'center', field: 'lineName',
formatter: function (row) { align: 'center',
return row.cellValue == 3.14159 ? '暂无数据' : row.cellValue formatter: function (row) {
} return row.cellValue ? row.cellValue : '/'
} }
], },
{
loadCallback: () => { title: '总谐波畸变率(%)',
tableStore.table.data = tree2List(tableStore.table.data, Math.random() * 1000) field: 'distortion',
tableStore.table.column[0].title = tableStore.table.params.statisticalType.name align: 'center',
chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params) formatter: function (row) {
setTimeout(() => { return row.cellValue == 3.14159 ? '暂无数据' : row.cellValue
activeName.value == 0 && tableRef.value && tableRef.value.getRef().setAllTreeExpand(true) }
}, 0) }
} ],
})
loadCallback: () => {
tableStore.table.params.statisticalType = classificationData[0] tableStore.table.data = tree2List(
tableStore.table.params.scale = [] filterTree(tableStore.table.data, node => {
tableStore.table.params.manufacturer = [] // 筛选条件name 包含关键词
tableStore.table.params.loadType = [] return node.name.includes(tableStore.table.params.searchValue)
tableStore.table.params.powerFlag = sign[0]?.algoDescribe || 0 }),
tableStore.table.params.serverName = 'harmonicBoot' Math.random() * 1000
provide('tableStore', tableStore) )
const tree2List = (list: any, id?: string) => { tableStore.table.column[0].title = tableStore.table.params.statisticalType.name
//存储结果的数组 chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params)
let arr: any = [] setTimeout(() => {
// 遍历 tree 数组 activeName.value == 0 && tableRef.value && tableRef.value.getRef().setAllTreeExpand(true)
list.forEach((item: any) => { }, 0)
item.uPid = id }
item.uId = Math.random() * 1000 })
item.valueOver == 3.14159 ? 0 : item.valueOver >= 90 ? 1 : item.valueOver && item.valueOver < 90 ? 2 : 3
// 判断item是否存在children tableStore.table.params.statisticalType = classificationData[0]
if (!item.children) return arr.push(item) tableStore.table.params.scale = []
// 函数递归对children数组进行tree2List的转换 tableStore.table.params.manufacturer = []
const children = tree2List(item.children, item.uId) tableStore.table.params.loadType = []
// 删除item的children属性 tableStore.table.params.powerFlag = sign[0]?.algoDescribe || 0
delete item.children tableStore.table.params.serverName = 'harmonicBoot'
// 把item和children数组添加至结果数组 tableStore.table.params.searchValue = ''
//..children: 意思是把children数组展开 provide('tableStore', tableStore)
arr.push(item, ...children) const tree2List = (list: any, id?: string) => {
}) //存储结果的数组
// 返回结果数组 let arr: any = []
return arr // 遍历 tree 数组
} list.forEach((item: any) => {
item.uPid = id
onMounted(() => { item.uId = Math.random() * 1000
tableStore.index() item.valueOver == 3.14159 ? 0 : item.valueOver >= 90 ? 1 : item.valueOver && item.valueOver < 90 ? 2 : 3
}) // 判断item是否存在children
</script> if (!item.children) return arr.push(item)
<style lang="scss" scoped> // 函数递归对children数组进行tree2List的转换
// .online { const children = tree2List(item.children, item.uId)
// width: 100%; // 删除item的children属性
// height: 100%; delete item.children
// .online_header { // 把item和children数组添加至结果数组
// width: 100%; //..children: 意思是把children数组展开
// max-height: 140px; arr.push(item, ...children)
// padding: 10px; })
// box-sizing: border-box; // 返回结果数组
// } return arr
// .online_main { }
// padding: 0 10px;
// } onMounted(() => {
// } tableStore.index()
</style> })
</script>
<style lang="scss" scoped>
// .online {
// width: 100%;
// height: 100%;
// .online_header {
// width: 100%;
// max-height: 140px;
// padding: 10px;
// box-sizing: border-box;
// }
// .online_main {
// padding: 0 10px;
// }
// }
</style>

View File

@@ -83,6 +83,14 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="关键字筛选">
<el-input
v-model.trim="tableStore.table.params.searchValue"
clearable
style="width: 200px"
placeholder="请输入关键字筛选"
/>
</el-form-item>
</template> </template>
</TableHeader> </TableHeader>
</div> </div>
@@ -113,6 +121,7 @@ import TableHeader from '@/components/table/header/index.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 charts from './components/charts.vue' import charts from './components/charts.vue'
import { filterTree } from '@/utils/tree'
defineOptions({ defineOptions({
name: 'harmonic-boot/area/qualifiedRate' name: 'harmonic-boot/area/qualifiedRate'
}) })
@@ -272,7 +281,13 @@ const tableStore = new TableStore({
], ],
loadCallback: () => { loadCallback: () => {
tableStore.table.data = tree2List(tableStore.table.data, Math.random() * 1000) tableStore.table.data = tree2List(
filterTree(tableStore.table.data, node => {
// 筛选条件name 包含关键词
return node.name.includes(tableStore.table.params.searchValue)
}),
Math.random() * 1000
)
tableStore.table.column[0].title = tableStore.table.params.statisticalType.name tableStore.table.column[0].title = tableStore.table.params.statisticalType.name
chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params) chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params)
@@ -288,6 +303,7 @@ tableStore.table.params.manufacturer = []
tableStore.table.params.loadType = [] tableStore.table.params.loadType = []
tableStore.table.params.serverName = 'harmonicBoot' tableStore.table.params.serverName = 'harmonicBoot'
tableStore.table.params.powerFlag = sign[0]?.algoDescribe || 0 tableStore.table.params.powerFlag = sign[0]?.algoDescribe || 0
tableStore.table.params.searchValue = ''
provide('tableStore', tableStore) provide('tableStore', tableStore)
// const tree2List = (list: any, pid?: string) => { // const tree2List = (list: any, pid?: string) => {
// //存储结果的数组 // //存储结果的数组

View File

@@ -1,365 +1,379 @@
<template> <template>
<div class="default-main online"> <div class="default-main online">
<div class="online_header"> <div class="online_header">
<TableHeader date-picker area ref="tableHeaderRef"> <TableHeader date-picker area ref="tableHeaderRef">
<template #select> <template #select>
<el-form-item label="统计类型:"> <el-form-item label="统计类型:">
<el-select <el-select
v-model="tableStore.table.params.statisticalType" v-model="tableStore.table.params.statisticalType"
placeholder="请选择统计类型" placeholder="请选择统计类型"
value-key="id" value-key="id"
style="width: 100%" style="width: 100%"
> >
<el-option <el-option
v-for="item in classificationData" v-for="item in classificationData"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item" :value="item"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="终端厂家:"> <el-form-item label="终端厂家:">
<el-select <el-select
v-model="tableStore.table.params.manufacturer" v-model="tableStore.table.params.manufacturer"
multiple multiple
collapse-tags collapse-tags
clearable clearable
placeholder="请选择终端厂家" placeholder="请选择终端厂家"
style="width: 100%" style="width: 100%"
value-key="id" value-key="id"
> >
<el-option <el-option
v-for="(item, index) in terminaloption" v-for="(item, index) in terminaloption"
:key="index" :key="index"
:label="item.name" :label="item.name"
:value="item" :value="item"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> <el-form-item label="关键字筛选">
</TableHeader> <el-input
</div> v-model.trim="tableStore.table.params.searchValue"
<div class="online_main"> clearable
<el-tabs v-model="activeName" type="border-card" @tab-click="handleClick"> style="width: 200px"
<el-tab-pane :name="0" :lazy="true" label="终端状态统计表"> placeholder="请输入关键字筛选"
<div class="table_legend"> />
<ul> </el-form-item>
<li> </template>
<p style="background: #339966"> </TableHeader>
<svg </div>
t="1722910570852" <div class="online_main">
class="icon" <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
viewBox="0 0 1336 1024" <el-tab-pane :name="0" :lazy="true" label="终端状态统计表">
version="1.1" <div class="table_legend">
xmlns="http://www.w3.org/2000/svg" <ul>
p-id="6243" <li>
width="16" <p style="background: #339966">
height="16" <svg
> t="1722910570852"
<path class="icon"
d="M49.588224 883.816448M1139.531776 883.816448M86.939648 862.977024M538.459136 960.381952c109.876224-153.544704 223.55968-289.842176 308.03968-385.787904 49.87392-56.639488 96.715776-108.155904 141.549568-154.500096 40.576-41.945088 80.805888-80.405504 119.478272-116.59264 65.92-61.693952 142.984192-130.034688 191.446016-159.30368l-61.891584-82.050048c-89.732096 56.139776-176.10752 116.103168-242.799616 162.18112-38.863872 26.855424-74.928128 52.667392-108.915712 77.252608-33.668096 24.356864-68.429824 51.106816-105.081856 79.166464-63.633408 48.712704-145.388544 114.194432-224.555008 181.860352L357.07904 374.989824 123.885568 558.770176 538.459136 960.381952zM1335.92064 862.977024" viewBox="0 0 1336 1024"
fill="#ffffff" version="1.1"
p-id="6244" xmlns="http://www.w3.org/2000/svg"
></path> p-id="6243"
</svg> width="16"
</p> height="16"
<span style="color: #339966">投运状态</span> >
</li> <path
<li> d="M49.588224 883.816448M1139.531776 883.816448M86.939648 862.977024M538.459136 960.381952c109.876224-153.544704 223.55968-289.842176 308.03968-385.787904 49.87392-56.639488 96.715776-108.155904 141.549568-154.500096 40.576-41.945088 80.805888-80.405504 119.478272-116.59264 65.92-61.693952 142.984192-130.034688 191.446016-159.30368l-61.891584-82.050048c-89.732096 56.139776-176.10752 116.103168-242.799616 162.18112-38.863872 26.855424-74.928128 52.667392-108.915712 77.252608-33.668096 24.356864-68.429824 51.106816-105.081856 79.166464-63.633408 48.712704-145.388544 114.194432-224.555008 181.860352L357.07904 374.989824 123.885568 558.770176 538.459136 960.381952zM1335.92064 862.977024"
<p style="background: #ffcc33"> fill="#ffffff"
<svg p-id="6244"
t="1722910570852" ></path>
class="icon" </svg>
viewBox="0 0 1336 1024" </p>
version="1.1" <span style="color: #339966">投运状态</span>
xmlns="http://www.w3.org/2000/svg" </li>
p-id="6243" <li>
width="16" <p style="background: #ffcc33">
height="16" <svg
> t="1722910570852"
<path class="icon"
d="M49.588224 883.816448M1139.531776 883.816448M86.939648 862.977024M538.459136 960.381952c109.876224-153.544704 223.55968-289.842176 308.03968-385.787904 49.87392-56.639488 96.715776-108.155904 141.549568-154.500096 40.576-41.945088 80.805888-80.405504 119.478272-116.59264 65.92-61.693952 142.984192-130.034688 191.446016-159.30368l-61.891584-82.050048c-89.732096 56.139776-176.10752 116.103168-242.799616 162.18112-38.863872 26.855424-74.928128 52.667392-108.915712 77.252608-33.668096 24.356864-68.429824 51.106816-105.081856 79.166464-63.633408 48.712704-145.388544 114.194432-224.555008 181.860352L357.07904 374.989824 123.885568 558.770176 538.459136 960.381952zM1335.92064 862.977024" viewBox="0 0 1336 1024"
fill="#ffffff" version="1.1"
p-id="6244" xmlns="http://www.w3.org/2000/svg"
></path> p-id="6243"
</svg> width="16"
</p> height="16"
<span style="color: #ffcc33">检修状态</span> >
</li> <path
<li> d="M49.588224 883.816448M1139.531776 883.816448M86.939648 862.977024M538.459136 960.381952c109.876224-153.544704 223.55968-289.842176 308.03968-385.787904 49.87392-56.639488 96.715776-108.155904 141.549568-154.500096 40.576-41.945088 80.805888-80.405504 119.478272-116.59264 65.92-61.693952 142.984192-130.034688 191.446016-159.30368l-61.891584-82.050048c-89.732096 56.139776-176.10752 116.103168-242.799616 162.18112-38.863872 26.855424-74.928128 52.667392-108.915712 77.252608-33.668096 24.356864-68.429824 51.106816-105.081856 79.166464-63.633408 48.712704-145.388544 114.194432-224.555008 181.860352L357.07904 374.989824 123.885568 558.770176 538.459136 960.381952zM1335.92064 862.977024"
<p style="background: #A52a2a"> fill="#ffffff"
<svg p-id="6244"
t="1722910570852" ></path>
class="icon" </svg>
viewBox="0 0 1336 1024" </p>
version="1.1" <span style="color: #ffcc33">检修状态</span>
xmlns="http://www.w3.org/2000/svg" </li>
p-id="6243" <li>
width="16" <p style="background: #a52a2a">
height="16" <svg
> t="1722910570852"
<path class="icon"
d="M49.588224 883.816448M1139.531776 883.816448M86.939648 862.977024M538.459136 960.381952c109.876224-153.544704 223.55968-289.842176 308.03968-385.787904 49.87392-56.639488 96.715776-108.155904 141.549568-154.500096 40.576-41.945088 80.805888-80.405504 119.478272-116.59264 65.92-61.693952 142.984192-130.034688 191.446016-159.30368l-61.891584-82.050048c-89.732096 56.139776-176.10752 116.103168-242.799616 162.18112-38.863872 26.855424-74.928128 52.667392-108.915712 77.252608-33.668096 24.356864-68.429824 51.106816-105.081856 79.166464-63.633408 48.712704-145.388544 114.194432-224.555008 181.860352L357.07904 374.989824 123.885568 558.770176 538.459136 960.381952zM1335.92064 862.977024" viewBox="0 0 1336 1024"
fill="#ffffff" version="1.1"
p-id="6244" xmlns="http://www.w3.org/2000/svg"
></path> p-id="6243"
</svg> width="16"
</p> height="16"
<span style="color: #A52a2a">停运状态</span> >
</li> <path
</ul> d="M49.588224 883.816448M1139.531776 883.816448M86.939648 862.977024M538.459136 960.381952c109.876224-153.544704 223.55968-289.842176 308.03968-385.787904 49.87392-56.639488 96.715776-108.155904 141.549568-154.500096 40.576-41.945088 80.805888-80.405504 119.478272-116.59264 65.92-61.693952 142.984192-130.034688 191.446016-159.30368l-61.891584-82.050048c-89.732096 56.139776-176.10752 116.103168-242.799616 162.18112-38.863872 26.855424-74.928128 52.667392-108.915712 77.252608-33.668096 24.356864-68.429824 51.106816-105.081856 79.166464-63.633408 48.712704-145.388544 114.194432-224.555008 181.860352L357.07904 374.989824 123.885568 558.770176 538.459136 960.381952zM1335.92064 862.977024"
</div> fill="#ffffff"
<Table p-id="6244"
ref="tableRef" ></path>
:tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }" </svg>
:scroll-y="{ enabled: true }" </p>
v-if="activeName == 0" <span style="color: #a52a2a">停运状态</span>
/> </li>
</el-tab-pane> </ul>
<el-tab-pane :name="1" :lazy="true" label="终端状态统计图"> </div>
<charts v-if="activeName == 1" ref="chartsRef" /> <Table
</el-tab-pane> ref="tableRef"
</el-tabs> :tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }"
</div> :scroll-y="{ enabled: true }"
</div> v-if="activeName == 0"
</template> />
<script lang="ts" setup> </el-tab-pane>
import { ref, onMounted, watch } from 'vue' <el-tab-pane :name="1" :lazy="true" label="终端状态统计图">
import { useDictData } from '@/stores/dictData' <charts v-if="activeName == 1" ref="chartsRef" />
import DatePicker from '@/components/form/datePicker/index.vue' </el-tab-pane>
import { getAreaDept } from '@/api/harmonic-boot/area' </el-tabs>
import TableHeader from '@/components/table/header/index.vue' </div>
import TableStore from '@/utils/tableStore' </div>
import Table from '@/components/table/index.vue' </template>
import charts from './components/charts.vue' <script lang="ts" setup>
defineOptions({ import { ref, onMounted, watch } from 'vue'
name: 'harmonic-boot/area/terminalonlinerate' import { useDictData } from '@/stores/dictData'
}) import DatePicker from '@/components/form/datePicker/index.vue'
const tableRef = ref() import { getAreaDept } from '@/api/harmonic-boot/area'
const chartsRef = ref() import TableHeader from '@/components/table/header/index.vue'
const dictData = useDictData() import TableStore from '@/utils/tableStore'
//字典获取电压等级 import Table from '@/components/table/index.vue'
const voltageleveloption = dictData.getBasicData('Dev_Voltage_Stand') import charts from './components/charts.vue'
//字典获取终端厂家 import { filterTree } from '@/utils/tree'
const terminaloption = dictData.getBasicData('Dev_Manufacturers') defineOptions({
//字典获取干扰源类型 name: 'harmonic-boot/area/terminalonlinerate'
const interfereoption = dictData.getBasicData('Interference_Source') })
//字典获取统计类型 const tableRef = ref()
const classificationData = dictData.getBasicData('Statistical_Type', ['Report_Type', 'Voltage_Level', 'Load_Type']) const chartsRef = ref()
//调用区域接口获取区域 const dictData = useDictData()
const treeData = ref([]) //字典获取电压等级
const idArr = ref([]) const voltageleveloption = dictData.getBasicData('Dev_Voltage_Stand')
const activeName = ref(0) //字典获取终端厂家
const getTreeData = async () => { const terminaloption = dictData.getBasicData('Dev_Manufacturers')
await getAreaDept().then(res => { //字典获取干扰源类型
var data = res.data const interfereoption = dictData.getBasicData('Interference_Source')
data.forEach(element => { //字典获取统计类型
idArr.value.push(element.id) const classificationData = dictData.getBasicData('Statistical_Type', ['Report_Type', 'Voltage_Level', 'Load_Type'])
}) //调用区域接口获取区域
treeData.value = JSON.parse(JSON.stringify(res.data)) const treeData = ref([])
}) const idArr = ref([])
} const activeName = ref(0)
getTreeData() const getTreeData = async () => {
await getAreaDept().then(res => {
const formData = ref({ var data = res.data
statisticalType: classificationData[0], //统计类型 data.forEach(element => {
deptIndex: treeData.value[0]?.id, //区域选择 idArr.value.push(element.id)
scale: voltageleveloption, //电压等级 })
manufacturer: terminaloption, //终端厂家 treeData.value = JSON.parse(JSON.stringify(res.data))
loadType: interfereoption //干扰源类型 })
// searchBeginTime: '', }
// searchEndTime: '' getTreeData()
})
formData.value.deptIndex = treeData.value[0]?.id const formData = ref({
const defaultProps = ref({ statisticalType: classificationData[0], //统计类型
label: 'name', deptIndex: treeData.value[0]?.id, //区域选择
value: 'id', scale: voltageleveloption, //电压等级
checkStrictly: true, manufacturer: terminaloption, //终端厂家
emitPath: false, loadType: interfereoption //干扰源类型
expandTrigger: 'click' as const // searchBeginTime: '',
}) // searchEndTime: ''
const handleClick = (tab: any, e: any) => { })
// if(activeName.value===1){ formData.value.deptIndex = treeData.value[0]?.id
tableStore.index() const defaultProps = ref({
// } label: 'name',
} value: 'id',
checkStrictly: true,
// const datePickerRef = ref() emitPath: false,
const tableHeaderRef = ref() expandTrigger: 'click' as const
const tableStore = new TableStore({ })
publicHeight: 100, const handleClick = (tab: any, e: any) => {
showPage: false, // if(activeName.value===1){
url: '/harmonic-boot/terminal/getTerminalData', tableStore.index()
method: 'POST', // }
}
column: [
{ // const datePickerRef = ref()
title: formData.value.statisticalType.name, const tableHeaderRef = ref()
field: 'name', const tableStore = new TableStore({
align: 'left', publicHeight: 100,
width: 350, showPage: false,
treeNode: true url: '/harmonic-boot/terminal/getTerminalData',
}, method: 'POST',
{
title: '终端个数(台)', column: [
field: 'number', {
align: 'center', title: formData.value.statisticalType.name,
formatter: function (row) { field: 'name',
return row.cellValue != 0 ? row.cellValue : '/' align: 'left',
} width: 350,
}, treeNode: true
{ },
title: '投运(台)', {
field: 'runFlag', title: '终端个数(台)',
type: 'html', field: 'number',
align: 'center', align: 'center',
formatter: function (row) { formatter: function (row) {
return row.cellValue == 0 return row.cellValue != 0 ? row.cellValue : '/'
? '/' }
: row.cellValue !== 0 && row.row.level !== 4 },
? row.cellValue {
: row.cellValue !== 0 && row.row.level == 4 && row.row.reaFlag == 0 && row.row.stopFlag == 0 title: '投运(台)',
? "<p class='table_icon' style='width: 18px;height: 18px;margin: 0 auto;display: flex;align-items: center;justify-content: center;border-radius: 50%;background: #339966'><svg t='1722910570852' class='icon' viewBox='0 0 1336 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='6243' width='16' height='16'><path d='M49.588224 883.816448M1139.531776 883.816448M86.939648 862.977024M538.459136 960.381952c109.876224-153.544704 223.55968-289.842176 308.03968-385.787904 49.87392-56.639488 96.715776-108.155904 141.549568-154.500096 40.576-41.945088 80.805888-80.405504 119.478272-116.59264 65.92-61.693952 142.984192-130.034688 191.446016-159.30368l-61.891584-82.050048c-89.732096 56.139776-176.10752 116.103168-242.799616 162.18112-38.863872 26.855424-74.928128 52.667392-108.915712 77.252608-33.668096 24.356864-68.429824 51.106816-105.081856 79.166464-63.633408 48.712704-145.388544 114.194432-224.555008 181.860352L357.07904 374.989824 123.885568 558.770176 538.459136 960.381952zM1335.92064 862.977024' fill='#ffffff' p-id='6244'></path></svg> </p>" field: 'runFlag',
: '/' type: 'html',
} align: 'center',
}, formatter: function (row) {
{ return row.cellValue == 0
title: '检修(台)', ? '/'
field: 'reaFlag', : row.cellValue !== 0 && row.row.level !== 4
type: 'html', ? row.cellValue
align: 'center', : row.cellValue !== 0 && row.row.level == 4 && row.row.reaFlag == 0 && row.row.stopFlag == 0
formatter: function (row) { ? "<p class='table_icon' style='width: 18px;height: 18px;margin: 0 auto;display: flex;align-items: center;justify-content: center;border-radius: 50%;background: #339966'><svg t='1722910570852' class='icon' viewBox='0 0 1336 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='6243' width='16' height='16'><path d='M49.588224 883.816448M1139.531776 883.816448M86.939648 862.977024M538.459136 960.381952c109.876224-153.544704 223.55968-289.842176 308.03968-385.787904 49.87392-56.639488 96.715776-108.155904 141.549568-154.500096 40.576-41.945088 80.805888-80.405504 119.478272-116.59264 65.92-61.693952 142.984192-130.034688 191.446016-159.30368l-61.891584-82.050048c-89.732096 56.139776-176.10752 116.103168-242.799616 162.18112-38.863872 26.855424-74.928128 52.667392-108.915712 77.252608-33.668096 24.356864-68.429824 51.106816-105.081856 79.166464-63.633408 48.712704-145.388544 114.194432-224.555008 181.860352L357.07904 374.989824 123.885568 558.770176 538.459136 960.381952zM1335.92064 862.977024' fill='#ffffff' p-id='6244'></path></svg> </p>"
return row.cellValue == 0 : '/'
? '/' }
: row.cellValue !== 0 && row.row.level !== 4 },
? row.cellValue {
: row.cellValue !== 0 && row.row.level == 4 && row.row.runFlag == 0 && row.row.stopFlag == 0 title: '检修(台)',
? "<p class='table_icon' style='width: 18px;height: 18px;margin: 0 auto;display: flex;align-items: center;justify-content: center;border-radius: 50%;background: #ffcc33'><svg t='1722910570852' class='icon' viewBox='0 0 1336 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='6243' width='16' height='16'><path d='M49.588224 883.816448M1139.531776 883.816448M86.939648 862.977024M538.459136 960.381952c109.876224-153.544704 223.55968-289.842176 308.03968-385.787904 49.87392-56.639488 96.715776-108.155904 141.549568-154.500096 40.576-41.945088 80.805888-80.405504 119.478272-116.59264 65.92-61.693952 142.984192-130.034688 191.446016-159.30368l-61.891584-82.050048c-89.732096 56.139776-176.10752 116.103168-242.799616 162.18112-38.863872 26.855424-74.928128 52.667392-108.915712 77.252608-33.668096 24.356864-68.429824 51.106816-105.081856 79.166464-63.633408 48.712704-145.388544 114.194432-224.555008 181.860352L357.07904 374.989824 123.885568 558.770176 538.459136 960.381952zM1335.92064 862.977024' fill='#ffffff' p-id='6244'></path></svg> </p>" field: 'reaFlag',
: '/' type: 'html',
} align: 'center',
}, formatter: function (row) {
{ return row.cellValue == 0
title: '停运(台)', ? '/'
field: 'stopFlag', : row.cellValue !== 0 && row.row.level !== 4
type: 'html', ? row.cellValue
align: 'center', : row.cellValue !== 0 && row.row.level == 4 && row.row.runFlag == 0 && row.row.stopFlag == 0
formatter: function (row) { ? "<p class='table_icon' style='width: 18px;height: 18px;margin: 0 auto;display: flex;align-items: center;justify-content: center;border-radius: 50%;background: #ffcc33'><svg t='1722910570852' class='icon' viewBox='0 0 1336 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='6243' width='16' height='16'><path d='M49.588224 883.816448M1139.531776 883.816448M86.939648 862.977024M538.459136 960.381952c109.876224-153.544704 223.55968-289.842176 308.03968-385.787904 49.87392-56.639488 96.715776-108.155904 141.549568-154.500096 40.576-41.945088 80.805888-80.405504 119.478272-116.59264 65.92-61.693952 142.984192-130.034688 191.446016-159.30368l-61.891584-82.050048c-89.732096 56.139776-176.10752 116.103168-242.799616 162.18112-38.863872 26.855424-74.928128 52.667392-108.915712 77.252608-33.668096 24.356864-68.429824 51.106816-105.081856 79.166464-63.633408 48.712704-145.388544 114.194432-224.555008 181.860352L357.07904 374.989824 123.885568 558.770176 538.459136 960.381952zM1335.92064 862.977024' fill='#ffffff' p-id='6244'></path></svg> </p>"
return row.cellValue == 0 : '/'
? '/' }
: row.cellValue !== 0 && row.row.level !== 4 },
? row.cellValue {
: row.cellValue !== 0 && row.row.level == 4 && row.row.runFlag == 0 && row.row.reaFlag == 0 title: '停运(台)',
? "<p class='table_icon' style='width: 18px;height: 18px;margin: 0 auto;display: flex;align-items: center;justify-content: center;border-radius: 50%;background: #A52a2a'><svg t='1722910570852' class='icon' viewBox='0 0 1336 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='6243' width='16' height='16'><path d='M49.588224 883.816448M1139.531776 883.816448M86.939648 862.977024M538.459136 960.381952c109.876224-153.544704 223.55968-289.842176 308.03968-385.787904 49.87392-56.639488 96.715776-108.155904 141.549568-154.500096 40.576-41.945088 80.805888-80.405504 119.478272-116.59264 65.92-61.693952 142.984192-130.034688 191.446016-159.30368l-61.891584-82.050048c-89.732096 56.139776-176.10752 116.103168-242.799616 162.18112-38.863872 26.855424-74.928128 52.667392-108.915712 77.252608-33.668096 24.356864-68.429824 51.106816-105.081856 79.166464-63.633408 48.712704-145.388544 114.194432-224.555008 181.860352L357.07904 374.989824 123.885568 558.770176 538.459136 960.381952zM1335.92064 862.977024' fill='#ffffff' p-id='6244'></path></svg> </p>" field: 'stopFlag',
: '/' type: 'html',
} align: 'center',
}, formatter: function (row) {
{ return row.cellValue == 0
title: '在线率(%)', ? '/'
field: 'onlineRateData', : row.cellValue !== 0 && row.row.level !== 4
align: 'center', ? row.cellValue
formatter: function (row) { : row.cellValue !== 0 && row.row.level == 4 && row.row.runFlag == 0 && row.row.reaFlag == 0
return row.cellValue == 3.14159 ? '暂无数据' : row.cellValue.toFixed(2) ? "<p class='table_icon' style='width: 18px;height: 18px;margin: 0 auto;display: flex;align-items: center;justify-content: center;border-radius: 50%;background: #A52a2a'><svg t='1722910570852' class='icon' viewBox='0 0 1336 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='6243' width='16' height='16'><path d='M49.588224 883.816448M1139.531776 883.816448M86.939648 862.977024M538.459136 960.381952c109.876224-153.544704 223.55968-289.842176 308.03968-385.787904 49.87392-56.639488 96.715776-108.155904 141.549568-154.500096 40.576-41.945088 80.805888-80.405504 119.478272-116.59264 65.92-61.693952 142.984192-130.034688 191.446016-159.30368l-61.891584-82.050048c-89.732096 56.139776-176.10752 116.103168-242.799616 162.18112-38.863872 26.855424-74.928128 52.667392-108.915712 77.252608-33.668096 24.356864-68.429824 51.106816-105.081856 79.166464-63.633408 48.712704-145.388544 114.194432-224.555008 181.860352L357.07904 374.989824 123.885568 558.770176 538.459136 960.381952zM1335.92064 862.977024' fill='#ffffff' p-id='6244'></path></svg> </p>"
} : '/'
} }
], },
// beforeSearchFun: () => { {
// tableStore.table.params.deptIndex = formData.value.deptIndex title: '在线率(%)',
// tableStore.table.params.statisticalType = formData.value.statisticalType field: 'onlineRateData',
// tableStore.table.params.scale = formData.value.scale align: 'center',
// tableStore.table.params.manufacturer = formData.value.manufacturer formatter: function (row) {
// tableStore.table.params.loadType = formData.value.loadType return row.cellValue == 3.14159 ? '暂无数据' : row.cellValue.toFixed(2)
// tableStore.table.params.serverName = 'harmonicBoot' }
// // delete tableStore.table.params.timeFlag }
// // delete tableStore.table.params.startTime ],
// // delete tableStore.table.params.endTime // beforeSearchFun: () => {
// // delete tableStore.table.params.pageNum // tableStore.table.params.deptIndex = formData.value.deptIndex
// // delete tableStore.table.params.pageSize // tableStore.table.params.statisticalType = formData.value.statisticalType
// // tableStore.table.params.searchBeginTime = tableHeaderRef.value.datePickerRef.timeValue[0] // tableStore.table.params.scale = formData.value.scale
// // tableStore.table.params.searchEndTime = tableHeaderRef.value.datePickerRef.timeValue[1] // tableStore.table.params.manufacturer = formData.value.manufacturer
// }, // tableStore.table.params.loadType = formData.value.loadType
loadCallback: () => { // tableStore.table.params.serverName = 'harmonicBoot'
tableStore.table.data = tree2List(tableStore.table.data, Math.random() * 1000) // // delete tableStore.table.params.timeFlag
tableStore.table.column[0].title = formData.value.statisticalType.name // // delete tableStore.table.params.startTime
// // delete tableStore.table.params.endTime
chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params) // // delete tableStore.table.params.pageNum
setTimeout(() => { // // delete tableStore.table.params.pageSize
activeName.value == 0 && tableRef.value && tableRef.value.getRef().setAllTreeExpand(true) // // tableStore.table.params.searchBeginTime = tableHeaderRef.value.datePickerRef.timeValue[0]
}, 0) // // tableStore.table.params.searchEndTime = tableHeaderRef.value.datePickerRef.timeValue[1]
} // },
}) loadCallback: () => {
tableStore.table.params.deptIndex = treeData.value[0]?.id tableStore.table.data = tree2List(
tableStore.table.params.statisticalType = classificationData[0] filterTree(tableStore.table.data, node => {
tableStore.table.params.scale = voltageleveloption return node.name.includes(tableStore.table.params.searchValue)
tableStore.table.params.manufacturer = terminaloption }),
tableStore.table.params.loadType = interfereoption Math.random() * 1000
tableStore.table.params.serverName = 'harmonicBoot' )
tableStore.table.column[0].title = formData.value.statisticalType.name
provide('tableStore', tableStore) chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params)
const tree2List = (list: any, id?: string) => { setTimeout(() => {
//存储结果的数组 activeName.value == 0 && tableRef.value && tableRef.value.getRef().setAllTreeExpand(true)
let arr: any = [] }, 0)
// 遍历 tree 数组 }
list.forEach((item: any) => { })
item.uPid = id tableStore.table.params.deptIndex = treeData.value[0]?.id
item.uId = Math.random() * 1000 tableStore.table.params.statisticalType = classificationData[0]
item.valueOver == 3.14159 ? 0 : item.valueOver >= 90 ? 1 : item.valueOver && item.valueOver < 90 ? 2 : 3 tableStore.table.params.scale = voltageleveloption
// 判断item是否存在children tableStore.table.params.manufacturer = terminaloption
if (!item.children) return arr.push(item) tableStore.table.params.loadType = interfereoption
// 函数递归对children数组进行tree2List的转换 tableStore.table.params.serverName = 'harmonicBoot'
const children = tree2List(item.children, item.uId) tableStore.table.params.searchValue = ''
// 删除item的children属性
delete item.children provide('tableStore', tableStore)
// 把item和children数组添加至结果数组 const tree2List = (list: any, id?: string) => {
//..children: 意思是把children数组展开 //存储结果的数组
arr.push(item, ...children) let arr: any = []
}) // 遍历 tree 数组
// 返回结果数组 list.forEach((item: any) => {
return arr item.uPid = id
} item.uId = Math.random() * 1000
item.valueOver == 3.14159 ? 0 : item.valueOver >= 90 ? 1 : item.valueOver && item.valueOver < 90 ? 2 : 3
onMounted(() => {}) // 判断item是否存在children
if (!item.children) return arr.push(item)
watch( // 函数递归对children数组进行tree2List的转换
() => treeData.value, const children = tree2List(item.children, item.uId)
(val, oldVal) => { // 删除item的children属性
if (val && val.length != 0) { delete item.children
formData.value.deptIndex = val[0].id // 把item和children数组添加至结果数组
tableStore.index() //..children: 意思是把children数组展开
} arr.push(item, ...children)
}, })
{ // 返回结果数组
immediate: true, return arr
deep: true }
}
) onMounted(() => {})
</script>
<style lang="scss" scoped> watch(
.table_legend { () => treeData.value,
width: 100%; (val, oldVal) => {
height: 40px; if (val && val.length != 0) {
display: flex; formData.value.deptIndex = val[0].id
align-items: center; tableStore.index()
justify-content: flex-end; }
align-items: center; },
ul { {
width: 280px; immediate: true,
height: 30px; deep: true
display: flex; }
justify-content: space-between; )
li { </script>
flex: 1; <style lang="scss" scoped>
list-style-type: none; .table_legend {
display: flex; width: 100%;
align-items: center; height: 40px;
justify-content: space-around; display: flex;
p { align-items: center;
width: 18px; justify-content: flex-end;
height: 18px; align-items: center;
border-radius: 50%; ul {
} width: 280px;
} height: 30px;
} display: flex;
} justify-content: space-between;
</style> li {
flex: 1;
list-style-type: none;
display: flex;
align-items: center;
justify-content: space-around;
p {
width: 18px;
height: 18px;
border-radius: 50%;
}
}
}
}
</style>

View File

@@ -68,14 +68,14 @@ const tableStore = new TableStore({
{ field: 'lineScale', title: '电压等级', minWidth: "120px", }, { field: 'lineScale', title: '电压等级', minWidth: "120px", },
{ field: 'lineName', title: '监测点名称', minWidth: "150px", }, { field: 'lineName', title: '监测点名称', minWidth: "150px", },
{ field: 'loadType', title: '干扰源类型', minWidth: "150px", }, { field: 'loadType', title: '干扰源类型', minWidth: "150px", },
{ field: 'lineObjectName', title: '监测点对象名称', minWidth: "150px", formatter: (row: any) => { return row.cellValue == null ? '/' : row.cellValue } }, { field: 'lineObjectName', title: '监测点对象名称', minWidth: "180px", formatter: (row: any) => { return row.cellValue == null ? '/' : row.cellValue } },
{ field: 'overDay', title: '超标天数', minWidth: "80px", }, { field: 'overDay', title: '超标天数', minWidth: "80px", },
{ field: 'freqOverDay', title: '频率偏差超标天数', minWidth: "100px", }, { field: 'freqOverDay', title: '频率偏差', minWidth: "100px", },
{ field: 'volDevOverDay', title: '电压偏差超标天数', minWidth: "100px", }, { field: 'volDevOverDay', title: '电压偏差', minWidth: "100px", },
{ field: 'volDisOverDay', title: '电压总畸变率超标天数', minWidth: "100px", }, { field: 'volDisOverDay', title: '电压总畸变率', minWidth: "100px", },
{ field: 'volContainOverDay', title: '谐波电压含有率超标天数', minWidth: "110px", }, { field: 'volContainOverDay', title: '谐波电压含有率', minWidth: "100px", },
{ field: 'harmVolOverDay', title: '谐波电压超标天数', minWidth: "100px", }, { field: 'harmVolOverDay', title: '谐波电压', minWidth: "100px", },
{ field: 'harmCurOverDay', title: '谐波电流超标天数', minWidth: "100px", }, { field: 'harmCurOverDay', title: '谐波电流', minWidth: "100px", },
{ {
title: '各次谐波电压含有率超标天数', title: '各次谐波电压含有率超标天数',
children: [ children: [
@@ -104,10 +104,11 @@ const tableStore = new TableStore({
], ],
}, },
{ field: 'threeUnbalance', title: '三相电压不平衡度超标天数', minWidth: "110px", }, { field: 'intHarmOverDay', title: '间谐波电压含有率', minWidth: "100px", },
{ field: 'negativeOverDay', title: '负序电流超标天数', minWidth: "100px", }, { field: 'threeUnbalance', title: '三相电压不平衡度', minWidth: "100px", },
{ field: 'flickerOverDay', title: '闪变超标天数', minWidth: "100px", }, { field: 'negativeOverDay', title: '负序电流', minWidth: "100px", },
{ field: 'monitorNumber', title: '监测点编号', minWidth: "180px", formatter: (row: any) => { return row.cellValue == null ? '/' : row.cellValue } }, { field: 'flickerOverDay', title: '闪变', minWidth: "100px", },
{ field: 'monitorNumber', title: '监测点编号', minWidth: "100px", formatter: (row: any) => { return row.cellValue == null ? '/' : row.cellValue } },

View File

@@ -162,14 +162,15 @@
<vxe-column field="company" title="供电公司" minWidth="110px"></vxe-column> <vxe-column field="company" title="供电公司" minWidth="110px"></vxe-column>
<vxe-column field="subStation" title="变电站" minWidth="110px"></vxe-column> <vxe-column field="subStation" title="变电站" minWidth="110px"></vxe-column>
<vxe-column field="manufacturer" title="终端厂家" minWidth="110px"></vxe-column> <vxe-column field="manufacturer" title="终端厂家" minWidth="110px"></vxe-column>
<vxe-column field="deviceName" title="终端名称" minWidth="110px"></vxe-column> <vxe-column field="deviceName" title="终端名称" minWidth="130px"></vxe-column>
<vxe-column field="ip" title="终端IP" :formatter="formatter" width="120px"></vxe-column> <vxe-column field="ip" title="终端IP" :formatter="formatter" width="120px"></vxe-column>
<vxe-column <vxe-column
field="lineName" field="lineName"
title="监测点名称" title="监测点名称"
:formatter="formatter" :formatter="formatter"
minWidth="110px" minWidth="130px"
></vxe-column> ></vxe-column>
<vxe-column v-if="VITE_FLAG" field="objName" title="监测对象" minWidth="130px"></vxe-column>
<vxe-column field="runFlag" title="运行状态" width="90px"> <vxe-column field="runFlag" title="运行状态" width="90px">
<template #default="{ row }"> <template #default="{ row }">
<el-tag <el-tag
@@ -222,6 +223,7 @@ defineOptions({
name: 'harmonic-boot/harmonic/getIntegrityData' name: 'harmonic-boot/harmonic/getIntegrityData'
}) })
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
const VITE_FLAG = import.meta.env.VITE_NAME != 'jibei'
const route = useRoute() const route = useRoute()
const dictData = useDictData() const dictData = useDictData()
//字典获取监督对象类型 //字典获取监督对象类型

View File

@@ -160,8 +160,9 @@
<vxe-column field="company" title="供电公司" minWidth="110px"></vxe-column> <vxe-column field="company" title="供电公司" minWidth="110px"></vxe-column>
<vxe-column field="subStation" title="变电站" minWidth="110px"></vxe-column> <vxe-column field="subStation" title="变电站" minWidth="110px"></vxe-column>
<vxe-column field="manufacturer" title="终端厂家" minWidth="110px"></vxe-column> <vxe-column field="manufacturer" title="终端厂家" minWidth="110px"></vxe-column>
<vxe-column field="deviceName" title="终端名称" minWidth="110px"></vxe-column> <vxe-column field="deviceName" title="终端名称" minWidth="130px"></vxe-column>
<vxe-column field="ip" title="终端IP" :formatter="formatter" width="120px"></vxe-column> <vxe-column field="ip" title="终端IP" :formatter="formatter" width="120px"></vxe-column>
<vxe-column field="runFlag" title="运行状态" width="90px"> <vxe-column field="runFlag" title="运行状态" width="90px">
<template #default="{ row }"> <template #default="{ row }">
<el-tag <el-tag
@@ -214,6 +215,7 @@ defineOptions({
name: 'harmonic-boot/harmonic/getIntegrityData' name: 'harmonic-boot/harmonic/getIntegrityData'
}) })
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
const VITE_FLAG = import.meta.env.VITE_NAME != 'jibei'
const route = useRoute() const route = useRoute()
const dictData = useDictData() const dictData = useDictData()
//字典获取监督对象类型 //字典获取监督对象类型

View File

@@ -744,16 +744,6 @@ const initEcharts = (color: string, key: number, name: string) => {
} }
//渲染echarts //渲染echarts
const init = () => { const init = () => {
loading.value = true
const url = localStorage.getItem('WebSocketUrl') || 'ws://192.168.1.68:10407/api/pushMessage/'
echartsDataV1.value = initEcharts('#DAA520', 0, 'A相')
echartsDataV2.value = initEcharts('#2E8B57', 0, 'B相')
echartsDataV3.value = initEcharts('#A52a2a', 0, 'C相')
echartsDataA1.value = initEcharts('#DAA520', 1, 'A相')
echartsDataA2.value = initEcharts('#2E8B57', 1, 'B相')
echartsDataA3.value = initEcharts('#A52a2a', 1, 'C相')
if (!dataSocket.socketServe) { if (!dataSocket.socketServe) {
console.error('WebSocket 客户端实例不存在') console.error('WebSocket 客户端实例不存在')
return return
@@ -765,9 +755,22 @@ const init = () => {
type: 'warning' type: 'warning'
}) })
} }
loading.value = true
const url = localStorage.getItem('WebSocketUrl') || 'null' //'ws://192.168.1.68:10407/api/pushMessage/'
echartsDataV1.value = initEcharts('#DAA520', 0, 'A相')
echartsDataV2.value = initEcharts('#2E8B57', 0, 'B相')
echartsDataV3.value = initEcharts('#A52a2a', 0, 'C相')
echartsDataA1.value = initEcharts('#DAA520', 1, 'A相')
echartsDataA2.value = initEcharts('#2E8B57', 1, 'B相')
echartsDataA3.value = initEcharts('#A52a2a', 1, 'C相')
let pids = monitoringPoint.state.pid.split(',') let pids = monitoringPoint.state.pid.split(',')
dataSocket.socketServe.connect(`${url}${adminInfo.id},${monitoringPoint.state.lineId},${pids[pids.length - 2]}`) dataSocket.socketServe.connect(`${url}${adminInfo.id},${monitoringPoint.state.lineId},${pids[pids.length - 2]}`)
dataSocket.socketServe.registerCallBack('message', (res: any) => { dataSocket.socketServe.registerCallBack('message', (res: any) => {
if (res.Flag === false) {
return (loading.value = false)
}
txtContent.value = res.value txtContent.value = res.value
let data = JSON.parse(res.value) let data = JSON.parse(res.value)
time.value = data.TIME - 0 time.value = data.TIME - 0
@@ -779,12 +782,12 @@ const init = () => {
iRmsA: data.I.A?.IRMS, //A相电流 iRmsA: data.I.A?.IRMS, //A相电流
iRmsB: data.I.B?.IRMS, //B相电流 iRmsB: data.I.B?.IRMS, //B相电流
iRmsC: data.I.C?.IRMS, //C相电流 iRmsC: data.I.C?.IRMS, //C相电流
v1AngA: data.V.A?.VFUND_ANGLE, //A相基波电压相位 v1AngA: steAngle(data.V.A?.VFUND_ANGLE), //A相基波电压相位
v1AngB: data.V.B?.VFUND_ANGLE, //B相基波电压相位 v1AngB: steAngle(data.V.B?.VFUND_ANGLE), //B相基波电压相位
v1AngC: data.V.C?.VFUND_ANGLE, //C相基波电压相位 v1AngC: steAngle(data.V.C?.VFUND_ANGLE), //C相基波电压相位
i1AngA: data.I.A?.I_ANGLE, //A相基波电流相位 i1AngA: steAngle(data.I.A?.I_ANGLE), //A相基波电流相位
i1AngB: data.I.B?.I_ANGLE, //B相基波电流相位 i1AngB: steAngle(data.I.B?.I_ANGLE), //B相基波电流相位
i1AngC: data.I.C?.I_ANGLE, //C相基波电流相位 i1AngC: steAngle(data.I.C?.I_ANGLE), //C相基波电流相位
freq: data.V.T?.FREQ, //频率 freq: data.V.T?.FREQ, //频率
freqDev: data.V.T?.DELTA_FREQ, //频率偏差 freqDev: data.V.T?.DELTA_FREQ, //频率偏差
vUnbalance: data.V.T?.V_UNBAN, //电压不平衡度 vUnbalance: data.V.T?.V_UNBAN, //电压不平衡度
@@ -950,6 +953,20 @@ const setRealData = () => {
] ]
pieChart6.value.initChart() pieChart6.value.initChart()
} }
const steAngle = (phase: any) => {
// 空值判断
if (phase === null || phase === undefined) {
return null
}
let normalizedPhase = phase % 360
if (normalizedPhase > 180) {
normalizedPhase -= 360
} else if (normalizedPhase < -180) {
normalizedPhase += 360
}
return normalizedPhase
}
defineExpose({ setRealData }) defineExpose({ setRealData })
onMounted(() => { onMounted(() => {
init() init()

View File

@@ -29,7 +29,11 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="数据筛选"> <el-form-item label="数据筛选">
<el-input v-model="tableStore.table.params.searchValue" clearable placeholder="输入市公司、变电站、用户" /> <el-input
v-model="tableStore.table.params.searchValue"
clearable
placeholder="输入市公司、变电站、用户"
/>
</el-form-item> </el-form-item>
<el-form-item label="通讯状态:"> <el-form-item label="通讯状态:">
@@ -102,8 +106,6 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> </template>
</TableHeader> </TableHeader>
<Table ref="tableRef" /> <Table ref="tableRef" />
@@ -115,6 +117,10 @@ 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 { useDictData } from '@/stores/dictData' import { useDictData } from '@/stores/dictData'
defineOptions({
name: 'harmonic-boot/run/terminalmessage'
})
const dictData = useDictData() const dictData = useDictData()
const view = ref(true) const view = ref(true)
@@ -159,7 +165,7 @@ const tableStore = new TableStore({
{ field: 'manufacturer', title: '厂家', minWidth: 100 }, { field: 'manufacturer', title: '厂家', minWidth: 100 },
{ field: 'devName', title: '终端名称', minWidth: 100 }, { field: 'devName', title: '终端名称', minWidth: 100 },
{ field: 'ip', title: '网络参数' ,width:110 }, { field: 'ip', title: '网络参数', width: 110 },
{ field: 'loginTime', title: '投运时间', minWidth: 90 }, { field: 'loginTime', title: '投运时间', minWidth: 90 },
{ field: 'devType', title: '终端型号', minWidth: 100 }, { field: 'devType', title: '终端型号', minWidth: 100 },
{ field: 'port', title: '端口', minWidth: 60 }, { field: 'port', title: '端口', minWidth: 60 },
@@ -186,8 +192,7 @@ const tableStore = new TableStore({
正常: 'success', 正常: 'success',
中断: 'danger' 中断: 'danger'
} }
}, }
], ],
beforeSearchFun: () => { beforeSearchFun: () => {
@@ -199,11 +204,11 @@ const tableStore = new TableStore({
tableStore.table.params.runFlag = [] tableStore.table.params.runFlag = []
if (tableStore.table.params.runF != null && tableStore.table.params.runF != '') { if (tableStore.table.params.runF != null && tableStore.table.params.runF != '') {
tableStore.table.params.runFlag = [tableStore.table.params.runF] tableStore.table.params.runFlag = tableStore.table.params.runF
} }
tableStore.table.params.comFlag = [] tableStore.table.params.comFlag = []
if (tableStore.table.params.comF != null&&tableStore.table.params.comF != '') { if (tableStore.table.params.comF != null && tableStore.table.params.comF != '') {
tableStore.table.params.comFlag = [tableStore.table.params.comF] tableStore.table.params.comFlag = tableStore.table.params.comF
} }
} }
}) })
@@ -220,7 +225,6 @@ tableStore.table.params.scale = []
tableStore.table.params.manufacturer = [] tableStore.table.params.manufacturer = []
tableStore.table.params.loadType = [] tableStore.table.params.loadType = []
provide('tableStore', tableStore) provide('tableStore', tableStore)
onMounted(() => { onMounted(() => {
tableStore.index() tableStore.index()

View File

@@ -27,7 +27,7 @@
<vxe-column field="lineName" title="监测点" width="120"></vxe-column> <vxe-column field="lineName" title="监测点" width="120"></vxe-column>
<vxe-column field="featureAmplitude" title="暂降(骤升)幅值(%)"> <vxe-column field="featureAmplitude" title="暂降(骤升)幅值(%)">
<template #default="{ row }"> <template #default="{ row }">
{{ (row.featureAmplitude * 100).toFixed(2) }} {{ row.featureAmplitude.toFixed(2) }}
</template> </template>
</vxe-column> </vxe-column>
<vxe-column field="duration" title="持续时间(s)"></vxe-column> <vxe-column field="duration" title="持续时间(s)"></vxe-column>

View File

@@ -12,12 +12,12 @@
</template> </template>
</el-page-header> </el-page-header>
</el-form-item> </el-form-item>
<el-form-item label="过滤筛选"> <el-form-item label="关键字筛选">
<el-input <el-input
style="width: 240px" style="width: 240px"
v-model="tableStore.table.params.searchValue" v-model="tableStore.table.params.searchValue"
clearable clearable
placeholder="请输入筛选数据" placeholder="请输入关键字筛选"
maxlength="32" maxlength="32"
show-word-limit show-word-limit
/> />