修改测试BUG
This commit is contained in:
@@ -119,3 +119,11 @@ export function resetFactory(data: any) {
|
|||||||
params: data
|
params: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
//修改mac后接入
|
||||||
|
export function accessByUpdateMac(data: any) {
|
||||||
|
return createAxios({
|
||||||
|
url: '/access-boot/device/accessByUpdateMac',
|
||||||
|
method: 'post',
|
||||||
|
params: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
81
src/components/CnDialog/CnDialog.vue
Normal file
81
src/components/CnDialog/CnDialog.vue
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
<template>
|
||||||
|
<ElDialogInner
|
||||||
|
v-bind="dialogAttrs"
|
||||||
|
:width="resolvedWidth"
|
||||||
|
:class="dialogClass"
|
||||||
|
:draggable="resolvedDraggable"
|
||||||
|
:close-on-click-modal="closeOnClickModal"
|
||||||
|
>
|
||||||
|
<template v-for="(_, name) in $slots" #[name]="slotData">
|
||||||
|
<slot :name="name" v-bind="slotData || {}" />
|
||||||
|
</template>
|
||||||
|
</ElDialogInner>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ElDialog as ElDialogInner } from 'element-plus'
|
||||||
|
import { computed, useAttrs } from 'vue'
|
||||||
|
import {
|
||||||
|
getDialogPreset,
|
||||||
|
resolveDialogSize,
|
||||||
|
resolveDialogSizeByClass,
|
||||||
|
type DialogSize
|
||||||
|
} from '@/config/dialog'
|
||||||
|
|
||||||
|
defineOptions({ inheritAttrs: false })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
/** 显式指定弹框尺寸:small | middle | big */
|
||||||
|
dialogSize?: DialogSize
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const attrs = useAttrs()
|
||||||
|
|
||||||
|
const resolvedSize = computed<DialogSize>(() => {
|
||||||
|
if (props.dialogSize) return props.dialogSize
|
||||||
|
|
||||||
|
const width = attrs.width as string | number | undefined
|
||||||
|
if (width !== undefined && width !== null && width !== '') {
|
||||||
|
return resolveDialogSize(width)
|
||||||
|
}
|
||||||
|
|
||||||
|
return resolveDialogSizeByClass(attrs.class)
|
||||||
|
})
|
||||||
|
|
||||||
|
const dialogPreset = computed(() => getDialogPreset(resolvedSize.value))
|
||||||
|
|
||||||
|
const resolvedWidth = computed(() => dialogPreset.value.width)
|
||||||
|
|
||||||
|
const dialogClass = computed(() => [
|
||||||
|
'cn-dialog',
|
||||||
|
`cn-dialog--${resolvedSize.value}`,
|
||||||
|
dialogPreset.value.class,
|
||||||
|
attrs.class
|
||||||
|
])
|
||||||
|
|
||||||
|
const dialogAttrs = computed(() => {
|
||||||
|
const {
|
||||||
|
width: _width,
|
||||||
|
class: _class,
|
||||||
|
draggable: _draggable,
|
||||||
|
closeOnClickModal: _closeOnClickModal,
|
||||||
|
...rest
|
||||||
|
} = attrs
|
||||||
|
const { 'close-on-click-modal': _closeOnClickModalKebab, ...restWithoutKebab } = rest as Record<
|
||||||
|
string,
|
||||||
|
unknown
|
||||||
|
>
|
||||||
|
return restWithoutKebab
|
||||||
|
})
|
||||||
|
|
||||||
|
const resolvedDraggable = computed(() => {
|
||||||
|
if (attrs.draggable !== undefined) return attrs.draggable as boolean
|
||||||
|
return dialogPreset.value.draggable
|
||||||
|
})
|
||||||
|
|
||||||
|
const closeOnClickModal = computed(() => {
|
||||||
|
if (attrs.closeOnClickModal !== undefined) return attrs.closeOnClickModal as boolean
|
||||||
|
if (attrs['close-on-click-modal'] !== undefined) return attrs['close-on-click-modal'] as boolean
|
||||||
|
return dialogPreset.value.closeOnClickModal
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<!-- 指标越限详情 -->
|
<!-- 指标越限详情 -->
|
||||||
<el-dialog draggable :title="title" v-model="dialogVisible" append-to-body width="70%">
|
<el-dialog draggable :title="title" v-model="dialogVisible" append-to-body width="1200">
|
||||||
<TableHeader datePicker showExport :showReset="false" ref="tableHeaderRef">
|
<TableHeader datePicker showExport :showReset="false" ref="tableHeaderRef">
|
||||||
<template v-slot:select>
|
<template v-slot:select>
|
||||||
<!-- <el-form-item label="监测点">
|
<!-- <el-form-item label="监测点">
|
||||||
|
|||||||
@@ -767,6 +767,9 @@ const initWave = (
|
|||||||
// min: rmscu[0]?.[1] - rmscu[0]?.[1] * 0.2 || 0,
|
// min: rmscu[0]?.[1] - rmscu[0]?.[1] * 0.2 || 0,
|
||||||
max: yRange.max,
|
max: yRange.max,
|
||||||
min: yRange.min,
|
min: yRange.min,
|
||||||
|
interval: yRange.interval,
|
||||||
|
minInterval: yRange.interval,
|
||||||
|
scale: false,
|
||||||
boundaryGap: [0, '100%'],
|
boundaryGap: [0, '100%'],
|
||||||
showLastLabel: true,
|
showLastLabel: true,
|
||||||
opposite: false,
|
opposite: false,
|
||||||
@@ -799,7 +802,7 @@ const initWave = (
|
|||||||
grid: {
|
grid: {
|
||||||
left: '60px',
|
left: '60px',
|
||||||
right: '45px',
|
right: '45px',
|
||||||
bottom: '40px',
|
bottom: '45px',
|
||||||
top: '60px'
|
top: '60px'
|
||||||
// containLabel: true
|
// containLabel: true
|
||||||
},
|
},
|
||||||
@@ -808,16 +811,17 @@ const initWave = (
|
|||||||
type: 'inside',
|
type: 'inside',
|
||||||
height: 13,
|
height: 13,
|
||||||
start: 0,
|
start: 0,
|
||||||
bottom: '20px',
|
|
||||||
|
bottom: '10px',
|
||||||
end: 100,
|
end: 100,
|
||||||
filterMode: 'filter'
|
filterMode: 'none'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
start: 0,
|
start: 0,
|
||||||
height: 13,
|
height: 13,
|
||||||
bottom: '20px',
|
bottom: '10px',
|
||||||
end: 100,
|
end: 100,
|
||||||
filterMode: 'filter'
|
filterMode: 'none'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
series: [
|
series: [
|
||||||
@@ -1101,6 +1105,9 @@ const drawPics = (
|
|||||||
showLastLabel: true,
|
showLastLabel: true,
|
||||||
max: yRange.max,
|
max: yRange.max,
|
||||||
min: yRange.min,
|
min: yRange.min,
|
||||||
|
interval: yRange.interval,
|
||||||
|
minInterval: yRange.interval,
|
||||||
|
scale: false,
|
||||||
opposite: false,
|
opposite: false,
|
||||||
// max: Math.floor((rmscm[0]?.[1] * 1.06 || 0) * 1.1 * 10) / 10,
|
// max: Math.floor((rmscm[0]?.[1] * 1.06 || 0) * 1.1 * 10) / 10,
|
||||||
// min: Math.floor((rmscu[0]?.[1] - rmscu[0]?.[1] * 0.2 || 0) * 10) / 10,
|
// min: Math.floor((rmscu[0]?.[1] - rmscu[0]?.[1] * 0.2 || 0) * 10) / 10,
|
||||||
@@ -1133,7 +1140,7 @@ const drawPics = (
|
|||||||
grid: {
|
grid: {
|
||||||
left: '60px',
|
left: '60px',
|
||||||
right: '45px',
|
right: '45px',
|
||||||
bottom: '40px',
|
bottom: '45px',
|
||||||
top: '60px'
|
top: '60px'
|
||||||
// containLabel: true
|
// containLabel: true
|
||||||
},
|
},
|
||||||
@@ -1142,14 +1149,17 @@ const drawPics = (
|
|||||||
type: 'inside',
|
type: 'inside',
|
||||||
height: 13,
|
height: 13,
|
||||||
start: 0,
|
start: 0,
|
||||||
bottom: '20px',
|
|
||||||
end: 100
|
bottom: '10px',
|
||||||
|
end: 100,
|
||||||
|
filterMode: 'none'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
start: 0,
|
start: 0,
|
||||||
height: 13,
|
height: 13,
|
||||||
bottom: '20px',
|
bottom: '10px',
|
||||||
end: 100
|
end: 100,
|
||||||
|
filterMode: 'none'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
series: [
|
series: [
|
||||||
|
|||||||
@@ -527,6 +527,9 @@ const initWave = (
|
|||||||
showLastLabel: true,
|
showLastLabel: true,
|
||||||
max: yRange.max,
|
max: yRange.max,
|
||||||
min: yRange.min,
|
min: yRange.min,
|
||||||
|
interval: yRange.interval,
|
||||||
|
minInterval: yRange.interval,
|
||||||
|
scale: false,
|
||||||
opposite: false,
|
opposite: false,
|
||||||
nameTextStyle: {
|
nameTextStyle: {
|
||||||
fontSize: '12px',
|
fontSize: '12px',
|
||||||
@@ -557,7 +560,7 @@ const initWave = (
|
|||||||
grid: {
|
grid: {
|
||||||
left: '60px',
|
left: '60px',
|
||||||
right: '45px',
|
right: '45px',
|
||||||
bottom: '40px',
|
bottom: '45px',
|
||||||
top: '60px'
|
top: '60px'
|
||||||
},
|
},
|
||||||
dataZoom: [
|
dataZoom: [
|
||||||
@@ -565,16 +568,17 @@ const initWave = (
|
|||||||
type: 'inside',
|
type: 'inside',
|
||||||
height: 13,
|
height: 13,
|
||||||
start: 0,
|
start: 0,
|
||||||
bottom: '20px',
|
|
||||||
|
bottom: '10px',
|
||||||
end: 100,
|
end: 100,
|
||||||
filterMode: 'filter'
|
filterMode: 'none'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
start: 0,
|
start: 0,
|
||||||
height: 13,
|
height: 13,
|
||||||
bottom: '20px',
|
bottom: '10px',
|
||||||
end: 100,
|
end: 100,
|
||||||
filterMode: 'filter'
|
filterMode: 'none'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
series: [
|
series: [
|
||||||
@@ -838,6 +842,9 @@ const drawPics = (
|
|||||||
showLastLabel: true,
|
showLastLabel: true,
|
||||||
max: yRange.max,
|
max: yRange.max,
|
||||||
min: yRange.min,
|
min: yRange.min,
|
||||||
|
interval: yRange.interval,
|
||||||
|
minInterval: yRange.interval,
|
||||||
|
scale: false,
|
||||||
opposite: false,
|
opposite: false,
|
||||||
nameTextStyle: {
|
nameTextStyle: {
|
||||||
fontSize: '12px',
|
fontSize: '12px',
|
||||||
@@ -868,7 +875,7 @@ const drawPics = (
|
|||||||
grid: {
|
grid: {
|
||||||
left: '60px',
|
left: '60px',
|
||||||
right: '45px',
|
right: '45px',
|
||||||
bottom: '40px',
|
bottom: '45px',
|
||||||
top: '60px'
|
top: '60px'
|
||||||
// containLabel: true
|
// containLabel: true
|
||||||
},
|
},
|
||||||
@@ -877,14 +884,17 @@ const drawPics = (
|
|||||||
type: 'inside',
|
type: 'inside',
|
||||||
height: 13,
|
height: 13,
|
||||||
start: 0,
|
start: 0,
|
||||||
bottom: '20px',
|
|
||||||
end: 100
|
bottom: '10px',
|
||||||
|
end: 100,
|
||||||
|
filterMode: 'none'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
start: 0,
|
start: 0,
|
||||||
height: 13,
|
height: 13,
|
||||||
bottom: '20px',
|
bottom: '10px',
|
||||||
end: 100
|
end: 100,
|
||||||
|
filterMode: 'none'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
series: [
|
series: [
|
||||||
|
|||||||
@@ -1,46 +1,100 @@
|
|||||||
<template>
|
<template>
|
||||||
<div style='border: 1px solid #e4e4e4;height: 100%'>
|
<div style="border: 1px solid #e4e4e4; height: 100%">
|
||||||
<Toolbar
|
<Toolbar
|
||||||
style='border-bottom: 1px solid #e4e4e4;border-top: 1px solid #e4e4e4'
|
style="border-bottom: 1px solid #e4e4e4; border-top: 1px solid #e4e4e4"
|
||||||
:editor='editorRef'
|
:editor="editorRef"
|
||||||
:defaultConfig='toolbarConfig'
|
:defaultConfig="toolbarConfig"
|
||||||
mode='default'
|
mode="default"
|
||||||
/>
|
/>
|
||||||
<Editor
|
<Editor
|
||||||
v-bind='$attrs'
|
v-model="innerHtml"
|
||||||
:defaultConfig='editorConfig'
|
:defaultConfig="editorConfig"
|
||||||
mode='default'
|
mode="default"
|
||||||
@onCreated='handleCreated'
|
@onCreated="handleCreated"
|
||||||
style='height: calc(100% - 42px); '
|
@onChange="handleChange"
|
||||||
|
style="height: calc(100% - 42px)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang='ts' setup>
|
|
||||||
import '@wangeditor/editor/dist/css/style.css' // 引入 css
|
|
||||||
|
|
||||||
import { onBeforeUnmount, ref, shallowRef, onMounted } from 'vue'
|
<script lang="ts" setup>
|
||||||
|
import '@wangeditor/editor/dist/css/style.css'
|
||||||
|
|
||||||
|
import { nextTick, onBeforeUnmount, ref, shallowRef, watch } from 'vue'
|
||||||
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
|
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
|
||||||
// 编辑器实例,必须用 shallowRef
|
|
||||||
const editorRef = shallowRef()
|
|
||||||
|
|
||||||
// 内容 HTML
|
const props = withDefaults(defineProps<{ modelValue?: string | null }>(), {
|
||||||
const valueHtml = ref('<p>hello</p>')
|
modelValue: ''
|
||||||
|
|
||||||
// 模拟 ajax 异步获取内容
|
|
||||||
onMounted(() => {
|
|
||||||
setTimeout(() => {
|
|
||||||
valueHtml.value = '<p>模拟 Ajax 异步设置内容</p>'
|
|
||||||
}, 1500)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'update:modelValue': [value: string]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const editorRef = shallowRef<any>()
|
||||||
|
const innerHtml = ref('<p><br></p>')
|
||||||
|
const isApplyingExternal = ref(false)
|
||||||
|
|
||||||
|
/** 清理 HTML,避免标签间空白文本节点导致 Slate 解析失败 */
|
||||||
|
function sanitizeEditorHtml(html: string | null | undefined): string {
|
||||||
|
if (html == null || html === '') return '<p><br></p>'
|
||||||
|
const cleaned = html
|
||||||
|
.replace(/>\s+</g, '><')
|
||||||
|
.replace(/(<\/li>)\s+(<li>)/g, '$1$2')
|
||||||
|
.trim()
|
||||||
|
return cleaned || '<p><br></p>'
|
||||||
|
}
|
||||||
|
|
||||||
|
function toSaveHtml(html: string): string {
|
||||||
|
return html === '<p><br></p>' ? '' : html
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyHtmlToEditor(html: string | null | undefined) {
|
||||||
|
const content = sanitizeEditorHtml(html)
|
||||||
|
const editor = editorRef.value
|
||||||
|
if (!editor || editor.isDestroyed) return
|
||||||
|
|
||||||
|
try {
|
||||||
|
const current = editor.getHtml()
|
||||||
|
if (current === content) return
|
||||||
|
} catch {
|
||||||
|
// ignore getHtml error on half-destroyed editor
|
||||||
|
}
|
||||||
|
|
||||||
|
isApplyingExternal.value = true
|
||||||
|
try {
|
||||||
|
editor.setHtml(content)
|
||||||
|
innerHtml.value = content
|
||||||
|
} catch {
|
||||||
|
try {
|
||||||
|
editor.setHtml('<p><br></p>')
|
||||||
|
innerHtml.value = '<p><br></p>'
|
||||||
|
} catch {
|
||||||
|
// editor may already be destroyed
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
nextTick(() => {
|
||||||
|
isApplyingExternal.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.modelValue,
|
||||||
|
val => {
|
||||||
|
applyHtmlToEditor(val)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
const toolbarConfig = {
|
const toolbarConfig = {
|
||||||
excludeKeys: ['fullScreen', 'emotion']
|
excludeKeys: ['fullScreen', 'emotion']
|
||||||
}
|
}
|
||||||
|
|
||||||
let sever = '/cs-harmonic-boot/csconfiguration/uploadImage'
|
let sever = '/cs-harmonic-boot/csconfiguration/uploadImage'
|
||||||
// 本地加api
|
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
sever = '/api' + sever
|
sever = '/api' + sever
|
||||||
}
|
}
|
||||||
|
|
||||||
const editorConfig = {
|
const editorConfig = {
|
||||||
placeholder: '请输入内容...',
|
placeholder: '请输入内容...',
|
||||||
MENU_CONF: {
|
MENU_CONF: {
|
||||||
@@ -52,23 +106,31 @@ const editorConfig = {
|
|||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
headers: {},
|
headers: {},
|
||||||
timeout: 0,
|
timeout: 0,
|
||||||
customInsert: (insertImg, result, editor) => {
|
customInsert: (insertImg: (url: string) => void, result: { data: { url: string } }) => {
|
||||||
const url = result.data.url
|
insertImg(result.data.url)
|
||||||
insertImg(url)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 组件销毁时,也及时销毁编辑器
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
const editor = editorRef.value
|
const editor = editorRef.value
|
||||||
if (editor == null) return
|
editorRef.value = undefined
|
||||||
|
if (editor == null || editor.isDestroyed) return
|
||||||
editor.destroy()
|
editor.destroy()
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleCreated = (editor) => {
|
const handleCreated = (editor: any) => {
|
||||||
editorRef.value = editor // 记录 editor 实例,重要!
|
editorRef.value = editor
|
||||||
|
nextTick(() => {
|
||||||
|
applyHtmlToEditor(props.modelValue)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleChange = (editor: { getHtml: () => string }) => {
|
||||||
|
if (isApplyingExternal.value) return
|
||||||
|
const html = editor.getHtml()
|
||||||
|
innerHtml.value = html
|
||||||
|
emit('update:modelValue', toSaveHtml(html))
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
125
src/config/dialog.ts
Normal file
125
src/config/dialog.ts
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
/**
|
||||||
|
* 系统弹框尺寸配置(大 / 中 / 小)
|
||||||
|
* 修改此处即可全局统一弹框宽度与默认行为
|
||||||
|
*/
|
||||||
|
export interface DialogPreset {
|
||||||
|
width: string
|
||||||
|
maxWidth: string
|
||||||
|
minWidth: string
|
||||||
|
closeOnClickModal: boolean
|
||||||
|
draggable: boolean
|
||||||
|
class: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export const dialogSmall: DialogPreset = {
|
||||||
|
width: '26vw',
|
||||||
|
maxWidth: '500px',
|
||||||
|
minWidth: '300px',
|
||||||
|
closeOnClickModal: false,
|
||||||
|
draggable: true,
|
||||||
|
class: 'dialog-small'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const dialogMiddle: DialogPreset = {
|
||||||
|
width: '42vw',
|
||||||
|
maxWidth: '800px',
|
||||||
|
minWidth: '600px',
|
||||||
|
closeOnClickModal: false,
|
||||||
|
draggable: true,
|
||||||
|
class: 'dialog-middle'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const dialogBig: DialogPreset = {
|
||||||
|
width: '62vw',
|
||||||
|
maxWidth: '1200px',
|
||||||
|
minWidth: '800px',
|
||||||
|
closeOnClickModal: false,
|
||||||
|
draggable: true,
|
||||||
|
class: 'dialog-big'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const DIALOG_PRESETS = {
|
||||||
|
small: dialogSmall,
|
||||||
|
middle: dialogMiddle,
|
||||||
|
big: dialogBig
|
||||||
|
} as const
|
||||||
|
|
||||||
|
export type DialogSize = keyof typeof DIALOG_PRESETS
|
||||||
|
|
||||||
|
export function getDialogPreset(size: DialogSize = 'small'): DialogPreset {
|
||||||
|
return DIALOG_PRESETS[size]
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDialogWidth(size: DialogSize = 'small'): string {
|
||||||
|
return DIALOG_PRESETS[size].width
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 将配置同步到 CSS 变量,供全局样式使用 */
|
||||||
|
export function applyDialogCssVars(): void {
|
||||||
|
;(Object.keys(DIALOG_PRESETS) as DialogSize[]).forEach(size => {
|
||||||
|
const preset = DIALOG_PRESETS[size]
|
||||||
|
document.documentElement.style.setProperty(`--cn-dialog-width-${size}`, preset.width)
|
||||||
|
document.documentElement.style.setProperty(`--cn-dialog-max-width-${size}`, preset.maxWidth)
|
||||||
|
document.documentElement.style.setProperty(`--cn-dialog-min-width-${size}`, preset.minWidth)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据原有 width 推断弹框尺寸(兼容现有 el-dialog 的 width 写法)
|
||||||
|
*/
|
||||||
|
export function resolveDialogSize(width: string | number): DialogSize {
|
||||||
|
const raw = String(width).trim().toLowerCase()
|
||||||
|
|
||||||
|
if (raw.endsWith('%')) {
|
||||||
|
const percent = parseFloat(raw)
|
||||||
|
if (Number.isNaN(percent)) return 'small'
|
||||||
|
if (percent >= 60) return 'big'
|
||||||
|
if (percent >= 40) return 'middle'
|
||||||
|
return 'small'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (raw.endsWith('vw')) {
|
||||||
|
const vw = parseFloat(raw)
|
||||||
|
if (Number.isNaN(vw)) return 'middle'
|
||||||
|
if (vw >= 55) return 'big'
|
||||||
|
if (vw >= 35) return 'middle'
|
||||||
|
return 'small'
|
||||||
|
}
|
||||||
|
|
||||||
|
const numeric = parseFloat(raw.replace(/px/g, ''))
|
||||||
|
if (Number.isNaN(numeric)) return 'small'
|
||||||
|
if (numeric >= 850) return 'big'
|
||||||
|
if (numeric >= 550) return 'middle'
|
||||||
|
return 'small'
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 无 width 时根据 class 推断尺寸 */
|
||||||
|
export function resolveDialogSizeByClass(classValue: unknown): DialogSize {
|
||||||
|
const classStr = normalizeClass(classValue)
|
||||||
|
|
||||||
|
if (classStr.includes('dialog-big')) return 'big'
|
||||||
|
if (classStr.includes('dialog-middle')) return 'middle'
|
||||||
|
if (classStr.includes('dialog-small')) return 'small'
|
||||||
|
|
||||||
|
if (classStr.includes('transient-filter-dialog')) return 'small'
|
||||||
|
if (classStr.includes('cn-operate-dialog')) return 'small'
|
||||||
|
|
||||||
|
if (classStr.includes('device-manage-popup') || classStr.includes('analysisList')) {
|
||||||
|
return 'big'
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'middle'
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeClass(classValue: unknown): string {
|
||||||
|
if (!classValue) return ''
|
||||||
|
if (typeof classValue === 'string') return classValue
|
||||||
|
if (Array.isArray(classValue)) return classValue.filter(Boolean).join(' ')
|
||||||
|
if (typeof classValue === 'object') {
|
||||||
|
return Object.entries(classValue as Record<string, boolean>)
|
||||||
|
.filter(([, active]) => active)
|
||||||
|
.map(([name]) => name)
|
||||||
|
.join(' ')
|
||||||
|
}
|
||||||
|
return String(classValue)
|
||||||
|
}
|
||||||
@@ -13,7 +13,8 @@ import 'element-plus/theme-chalk/display.css'
|
|||||||
import '@fortawesome/fontawesome-free/css/all.css'
|
import '@fortawesome/fontawesome-free/css/all.css'
|
||||||
import '@/styles/index.scss'
|
import '@/styles/index.scss'
|
||||||
import '@/assets/font/iconfont.css'
|
import '@/assets/font/iconfont.css'
|
||||||
import { ElDialog } from 'element-plus'
|
import CnDialog from '@/components/CnDialog/CnDialog.vue'
|
||||||
|
import { applyDialogCssVars } from '@/config/dialog'
|
||||||
import ExcelJS from 'exceljs'
|
import ExcelJS from 'exceljs'
|
||||||
import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx'
|
import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx'
|
||||||
VXETable.use(VXETablePluginExportXLSX, {
|
VXETable.use(VXETablePluginExportXLSX, {
|
||||||
@@ -21,13 +22,14 @@ VXETable.use(VXETablePluginExportXLSX, {
|
|||||||
})
|
})
|
||||||
window.XEUtils = XEUtils
|
window.XEUtils = XEUtils
|
||||||
|
|
||||||
|
applyDialogCssVars()
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
|
||||||
app.use(router)
|
app.use(router)
|
||||||
app.use(pinia)
|
app.use(pinia)
|
||||||
app.use(ElementPlus);
|
app.use(ElementPlus)
|
||||||
(app._context.components.ElDialog as typeof ElDialog).props.closeOnClickModal.default = false
|
app.component('ElDialog', CnDialog)
|
||||||
app.use(VXETable)
|
app.use(VXETable)
|
||||||
registerIcons(app) // icons
|
registerIcons(app) // icons
|
||||||
|
|
||||||
|
|||||||
@@ -346,12 +346,6 @@ body,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 1024px) {
|
|
||||||
.cn-operate-dialog {
|
|
||||||
width: 96%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 991px) {
|
@media screen and (max-width: 991px) {
|
||||||
.user-views {
|
.user-views {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|||||||
53
src/styles/dialog.scss
Normal file
53
src/styles/dialog.scss
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/* 弹框尺寸 - CSS 变量由 config/dialog.ts 在启动时注入 */
|
||||||
|
:root {
|
||||||
|
--cn-dialog-width-small: 26vw;
|
||||||
|
--cn-dialog-max-width-small: 500px;
|
||||||
|
--cn-dialog-min-width-small: 300px;
|
||||||
|
|
||||||
|
--cn-dialog-width-middle: 42vw;
|
||||||
|
--cn-dialog-max-width-middle: 800px;
|
||||||
|
--cn-dialog-min-width-middle: 600px;
|
||||||
|
|
||||||
|
--cn-dialog-width-big: 62vw;
|
||||||
|
--cn-dialog-max-width-big: 1200px;
|
||||||
|
--cn-dialog-min-width-big: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cn-dialog.el-dialog {
|
||||||
|
max-width: calc(100vw - 32px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cn-dialog--small.el-dialog,
|
||||||
|
.dialog-small.el-dialog {
|
||||||
|
width: var(--cn-dialog-width-small) !important;
|
||||||
|
max-width: var(--cn-dialog-max-width-small) !important;
|
||||||
|
min-width: var(--cn-dialog-min-width-small) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cn-dialog--middle.el-dialog,
|
||||||
|
.dialog-middle.el-dialog {
|
||||||
|
width: var(--cn-dialog-width-middle) !important;
|
||||||
|
max-width: var(--cn-dialog-max-width-middle) !important;
|
||||||
|
min-width: var(--cn-dialog-min-width-middle) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cn-dialog--big.el-dialog,
|
||||||
|
.dialog-big.el-dialog {
|
||||||
|
width: var(--cn-dialog-width-big) !important;
|
||||||
|
max-width: var(--cn-dialog-max-width-big) !important;
|
||||||
|
min-width: var(--cn-dialog-min-width-big) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 1024px) {
|
||||||
|
.cn-dialog--small.el-dialog,
|
||||||
|
.cn-dialog--middle.el-dialog,
|
||||||
|
.cn-dialog--big.el-dialog,
|
||||||
|
.dialog-small.el-dialog,
|
||||||
|
.dialog-middle.el-dialog,
|
||||||
|
.dialog-big.el-dialog,
|
||||||
|
.cn-operate-dialog.el-dialog {
|
||||||
|
width: 96% !important;
|
||||||
|
min-width: unset !important;
|
||||||
|
max-width: calc(100vw - 32px) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,3 +3,4 @@
|
|||||||
@use '@/styles/element';
|
@use '@/styles/element';
|
||||||
@use '@/styles/var';
|
@use '@/styles/var';
|
||||||
@use '@/styles/map';
|
@use '@/styles/map';
|
||||||
|
@use '@/styles/dialog';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog width="500px" v-model.trim='dialogVisible' :title='title'>
|
<el-dialog v-model.trim="dialogVisible" width="500px" :title="title" dialog-size="small">
|
||||||
<el-scrollbar>
|
<el-scrollbar>
|
||||||
<el-form :inline='false' :model='form' label-width='auto' class="form-one" :rules='rules' ref='formRef'>
|
<el-form :inline='false' :model='form' label-width='auto' class="form-one" :rules='rules' ref='formRef'>
|
||||||
<el-form-item label='角色名称'>
|
<el-form-item label='角色名称'>
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
const AXIS_DECIMALS = 2
|
const AXIS_DECIMALS = 2
|
||||||
|
/** 与 formatAxisLabel 小数位一致,刻度步长不得小于此值,避免标签重复 */
|
||||||
|
const MIN_TICK_STEP = 10 ** -AXIS_DECIMALS
|
||||||
|
|
||||||
|
export interface YAxisRange {
|
||||||
|
min: number
|
||||||
|
max: number
|
||||||
|
interval: number
|
||||||
|
}
|
||||||
|
|
||||||
export function roundAxisValue(val: number, decimals = AXIS_DECIMALS): number {
|
export function roundAxisValue(val: number, decimals = AXIS_DECIMALS): number {
|
||||||
if (!Number.isFinite(val)) return 0
|
if (!Number.isFinite(val)) return 0
|
||||||
@@ -12,12 +20,61 @@ export function formatAxisLabel(value: number): string {
|
|||||||
return String(Number(roundAxisValue(value).toFixed(AXIS_DECIMALS)))
|
return String(Number(roundAxisValue(value).toFixed(AXIS_DECIMALS)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 根据数据范围计算与显示精度对齐的刻度步长 */
|
||||||
|
function calcNiceTickInterval(range: number, maxTicks = 6): number {
|
||||||
|
if (!Number.isFinite(range) || range <= 0) return MIN_TICK_STEP
|
||||||
|
|
||||||
|
const raw = range / maxTicks
|
||||||
|
const magnitude = 10 ** Math.floor(Math.log10(raw))
|
||||||
|
const normalized = raw / magnitude
|
||||||
|
|
||||||
|
let niceFactor: number
|
||||||
|
if (normalized <= 1) niceFactor = 1
|
||||||
|
else if (normalized <= 2) niceFactor = 2
|
||||||
|
else if (normalized <= 5) niceFactor = 5
|
||||||
|
else niceFactor = 10
|
||||||
|
|
||||||
|
let interval = niceFactor * magnitude
|
||||||
|
|
||||||
|
if (interval < MIN_TICK_STEP) {
|
||||||
|
interval = MIN_TICK_STEP
|
||||||
|
} else {
|
||||||
|
interval = Math.ceil(interval / MIN_TICK_STEP) * MIN_TICK_STEP
|
||||||
|
}
|
||||||
|
|
||||||
|
return roundAxisValue(interval)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 将 min/max 对齐到刻度步长边界 */
|
||||||
|
function alignAxisToInterval(min: number, max: number, interval: number): { min: number; max: number } {
|
||||||
|
const alignedMin = Math.floor(min / interval) * interval
|
||||||
|
let alignedMax = Math.ceil(max / interval) * interval
|
||||||
|
|
||||||
|
if (alignedMax <= alignedMin) {
|
||||||
|
alignedMax = alignedMin + interval
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
min: roundAxisValue(alignedMin),
|
||||||
|
max: roundAxisValue(alignedMax)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildYAxisRange(axisMin: number, axisMax: number): YAxisRange {
|
||||||
|
const interval = calcNiceTickInterval(axisMax - axisMin)
|
||||||
|
const aligned = alignAxisToInterval(axisMin, axisMax, interval)
|
||||||
|
return {
|
||||||
|
...aligned,
|
||||||
|
interval
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 瞬间波形 Y 轴范围 */
|
/** 瞬间波形 Y 轴范围 */
|
||||||
export function calcShuYAxisRange(dataMin: number, dataMax: number): { min: number; max: number } {
|
export function calcShuYAxisRange(dataMin: number, dataMax: number): YAxisRange {
|
||||||
const min = Number(dataMin)
|
const min = Number(dataMin)
|
||||||
const max = Number(dataMax)
|
const max = Number(dataMax)
|
||||||
if (!Number.isFinite(min) || !Number.isFinite(max)) {
|
if (!Number.isFinite(min) || !Number.isFinite(max)) {
|
||||||
return { min: 0, max: 1 }
|
return buildYAxisRange(0, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
let axisMax = max * 1.1
|
let axisMax = max * 1.1
|
||||||
@@ -29,18 +86,15 @@ export function calcShuYAxisRange(dataMin: number, dataMax: number): { min: numb
|
|||||||
axisMin = min - pad
|
axisMin = min - pad
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return buildYAxisRange(axisMin, axisMax)
|
||||||
min: roundAxisValue(axisMin),
|
|
||||||
max: roundAxisValue(axisMax)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** RMS 波形 Y 轴范围 */
|
/** RMS 波形 Y 轴范围 */
|
||||||
export function calcRmsYAxisRange(dataMin: number, dataMax: number): { min: number; max: number } {
|
export function calcRmsYAxisRange(dataMin: number, dataMax: number): YAxisRange {
|
||||||
const min = Number(dataMin)
|
const min = Number(dataMin)
|
||||||
const max = Number(dataMax)
|
const max = Number(dataMax)
|
||||||
if (!Number.isFinite(min) || !Number.isFinite(max)) {
|
if (!Number.isFinite(min) || !Number.isFinite(max)) {
|
||||||
return { min: 0, max: 1 }
|
return buildYAxisRange(0, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
let axisMax = max * 1.06 * 1.1
|
let axisMax = max * 1.06 * 1.1
|
||||||
@@ -52,8 +106,5 @@ export function calcRmsYAxisRange(dataMin: number, dataMax: number): { min: numb
|
|||||||
axisMin = min - pad
|
axisMin = min - pad
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return buildYAxisRange(axisMin, axisMax)
|
||||||
min: roundAxisValue(axisMin),
|
|
||||||
max: roundAxisValue(axisMax)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,10 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
|||||||
config.headers.Authorization = 'Basic bmpjbnRlc3Q6bmpjbnBxcw=='
|
config.headers.Authorization = 'Basic bmpjbnRlc3Q6bmpjbnBxcw=='
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.url == '/user-boot/user/generateSm2Key' || config.url == '/pqs-auth/oauth/token') {
|
if (
|
||||||
|
config.url == '/user-boot/user/generateSm2Key' ||
|
||||||
|
config.url == '/pqs-auth/oauth/token'
|
||||||
|
) {
|
||||||
config.headers.Authorization = 'Basic bmpjbnRlc3Q6bmpjbnBxcw=='
|
config.headers.Authorization = 'Basic bmpjbnRlc3Q6bmpjbnBxcw=='
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog width="700px" v-model.trim="dialogVisible" :title="title">
|
<el-dialog width="500px" v-model.trim="dialogVisible" :title="title">
|
||||||
<el-scrollbar>
|
<el-scrollbar>
|
||||||
<el-form
|
<el-form
|
||||||
:mode="form"
|
:mode="form"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog class="cn-operate-dialog" width="700px" v-model.trim="dialogVisible" :title="title">
|
<el-dialog class="cn-operate-dialog" width="500px" v-model.trim="dialogVisible" :title="title">
|
||||||
<el-scrollbar>
|
<el-scrollbar>
|
||||||
<el-form :inline="false" :model="form" label-width="auto" ref="formRef" class="form-one" :rules="rules">
|
<el-form :inline="false" :model="form" label-width="auto" ref="formRef" class="form-one" :rules="rules">
|
||||||
<el-form-item label="上级菜单">
|
<el-form-item label="上级菜单">
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog class="cn-operate-dialog" v-model.trim="dialogVisible" :title="title">
|
<el-dialog class="cn-operate-dialog" v-model.trim="dialogVisible" width="800" :title="title">
|
||||||
<el-form :model="form" ref="formRef" label-width="auto" class="form-two" :rules="rules">
|
<el-form :model="form" ref="formRef" label-width="auto" class="form-two" :rules="rules">
|
||||||
<el-form-item label="用户名" prop="name">
|
<el-form-item label="用户名" prop="name">
|
||||||
<el-input maxlength="32" show-word-limit v-model.trim="form.name" placeholder="请输入昵称" />
|
<el-input maxlength="32" show-word-limit v-model.trim="form.name" placeholder="请输入昵称" />
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="visible" title="事件筛选" width="450px" append-to-body draggable class="transient-filter-dialog">
|
<el-dialog v-model="visible" title="事件筛选" width="500px" append-to-body draggable class="transient-filter-dialog">
|
||||||
<el-form label-width="auto" class="filter-form">
|
<el-form label-width="auto" class="filter-form">
|
||||||
<el-form-item label="暂态幅值(%)">
|
<el-form-item label="暂态幅值(%)">
|
||||||
<div class="range-inputs">
|
<div class="range-inputs">
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog class="cn-operate-dialog" draggable v-model="dialogVisible" :title="title" width="900px"
|
<el-dialog class="cn-operate-dialog" draggable v-model="dialogVisible" :title="title" width="800px"
|
||||||
@closed="handleClosed">
|
@closed="handleClosed">
|
||||||
<el-scrollbar max-height="60vh">
|
<el-scrollbar max-height="60vh">
|
||||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="auto" class="form-two">
|
<el-form ref="formRef" :model="form" :rules="rules" label-width="auto" class="form-two">
|
||||||
|
|||||||
@@ -135,13 +135,13 @@
|
|||||||
:data="menuTree" :checkStrictly="checkStrictly"></Tree>
|
:data="menuTree" :checkStrictly="checkStrictly"></Tree>
|
||||||
</div>
|
</div>
|
||||||
<!-- 新增/编辑弹框 -->
|
<!-- 新增/编辑弹框 -->
|
||||||
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="400px" :before-close="handleClose">
|
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="500px" :before-close="handleClose">
|
||||||
<el-form :model="formData" :rules="formRules" ref="formRef" label-width="100px">
|
<el-form :model="formData" :rules="formRules" ref="formRef" class="form-one" label-width="100px">
|
||||||
<el-form-item label="方案名称" prop="name">
|
<el-form-item label="方案名称" prop="name">
|
||||||
<el-input maxlength="32" show-word-limit v-model.trim="formData.name" placeholder="请输入方案名称" clearable />
|
<el-input maxlength="32" show-word-limit v-model.trim="formData.name" placeholder="请输入方案名称" clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="排序" prop="sort">
|
<el-form-item label="排序" prop="sort">
|
||||||
<el-input-number v-model.number="formData.sort" :min="0" />
|
<el-input-number v-model.number="formData.sort" :min="0" style="width: 100%;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
|
|||||||
@@ -205,8 +205,9 @@
|
|||||||
(nodeLevel >= 2 || pageStatus == 2) &&
|
(nodeLevel >= 2 || pageStatus == 2) &&
|
||||||
formData.deviceInfoList.length > 0
|
formData.deviceInfoList.length > 0
|
||||||
">
|
">
|
||||||
<el-tabs v-model="busBarIndex" type="border-card" :addable="false" :closable="pageStatus != 1"
|
<el-tabs v-model="busBarIndex" type="border-card" :addable="false"
|
||||||
@edit="handleBusBarTabsEdit" @tab-click="tabChange('busBarIndex', $event)">
|
:closable="pageStatus != 1 && connectionMethod != 'MQTT'" @edit="handleBusBarTabsEdit"
|
||||||
|
@tab-click="tabChange('busBarIndex', $event)">
|
||||||
<el-tab-pane v-for="(busItem, bIndex) in formData.deviceInfoList" :key="bIndex"
|
<el-tab-pane v-for="(busItem, bIndex) in formData.deviceInfoList" :key="bIndex"
|
||||||
:label="busItem.name ? busItem.name : '新建设备' + bIndex" :name="bIndex + ''">
|
:label="busItem.name ? busItem.name : '新建设备' + bIndex" :name="bIndex + ''">
|
||||||
<div class="flex mt10">
|
<div class="flex mt10">
|
||||||
@@ -403,7 +404,7 @@
|
|||||||
formData.lineInfoList.length > 0
|
formData.lineInfoList.length > 0
|
||||||
">
|
">
|
||||||
<!-- connectionMethod != 'MQTT' -->
|
<!-- connectionMethod != 'MQTT' -->
|
||||||
<el-tabs type="border-card" v-model="lineIndex" :addable="false" :closable="pageStatus != 1"
|
<el-tabs type="border-card" v-model="lineIndex" :addable="false" :closable="pageStatus != 1 && connectionMethod != 'MQTT'"
|
||||||
@edit="handleLineTabsEdit" @tab-click="tabChange('lineIndex', $event)">
|
@edit="handleLineTabsEdit" @tab-click="tabChange('lineIndex', $event)">
|
||||||
<el-tab-pane v-for="(lineItem, lIndex) in formData.lineInfoList" :key="lIndex"
|
<el-tab-pane v-for="(lineItem, lIndex) in formData.lineInfoList" :key="lIndex"
|
||||||
:label="lineItem.name ? lineItem.name : '新建监测点' + lIndex" :name="lIndex + ''">
|
:label="lineItem.name ? lineItem.name : '新建监测点' + lIndex" :name="lIndex + ''">
|
||||||
@@ -543,7 +544,7 @@
|
|||||||
trigger: 'change'
|
trigger: 'change'
|
||||||
}">
|
}">
|
||||||
<el-select clearable filterable v-model="lineItem.lineInterval"
|
<el-select clearable filterable v-model="lineItem.lineInterval"
|
||||||
placeholder="请选择统计间隔" :disabled="!(
|
placeholder="请选择统计间隔" :disabled="!(connectionMethod != 'MQTT' &&
|
||||||
(nodeLevel == 4 && pageStatus == 3) ||
|
(nodeLevel == 4 && pageStatus == 3) ||
|
||||||
((nodeLevel == 3 || (nodeLevel == 2 && pageStatus == 2)) &&
|
((nodeLevel == 3 || (nodeLevel == 2 && pageStatus == 2)) &&
|
||||||
pageStatus == 2)
|
pageStatus == 2)
|
||||||
@@ -647,7 +648,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item class="form-item" label="监测位置">
|
<el-form-item class="form-item" label="监测位置">
|
||||||
<el-select clearable filterable v-model="lineItem.position"
|
<el-select clearable filterable v-model="lineItem.position"
|
||||||
placeholder="请选择监测位置" :disabled="!(
|
placeholder="请选择监测位置" :disabled="!(connectionMethod != 'MQTT' &&
|
||||||
(nodeLevel == 4 && pageStatus == 3) ||
|
(nodeLevel == 4 && pageStatus == 3) ||
|
||||||
((nodeLevel == 3 || (nodeLevel == 2 && pageStatus == 2)) &&
|
((nodeLevel == 3 || (nodeLevel == 2 && pageStatus == 2)) &&
|
||||||
pageStatus == 2)
|
pageStatus == 2)
|
||||||
@@ -919,7 +920,7 @@ const project = ref([
|
|||||||
const wiringTypeArr = ref([
|
const wiringTypeArr = ref([
|
||||||
{ name: '星型接线', value: 0 },
|
{ name: '星型接线', value: 0 },
|
||||||
{ name: '三角型接线', value: 1 },
|
{ name: '三角型接线', value: 1 },
|
||||||
{ name: '开口三角型接线', value: 2 }
|
{ name: 'V型接线', value: 2 }
|
||||||
])
|
])
|
||||||
/**监测点序号 */
|
/**监测点序号 */
|
||||||
const pointNumArr = ref([
|
const pointNumArr = ref([
|
||||||
|
|||||||
@@ -552,6 +552,7 @@ const handleTrend = async () => {
|
|||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
realTrendRef.value && realTrendRef.value.setRealTrendData(false)
|
realTrendRef.value && realTrendRef.value.setRealTrendData(false)
|
||||||
|
harmonicSpectrumRef.value && harmonicSpectrumRef.value.setloading()
|
||||||
tableLoading.value = false
|
tableLoading.value = false
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -559,8 +560,12 @@ const handleTrend = async () => {
|
|||||||
if (res.code == 'A0000') {
|
if (res.code == 'A0000') {
|
||||||
realTrendRef.value && realTrendRef.value.setOverLimitData(res.data)
|
realTrendRef.value && realTrendRef.value.setOverLimitData(res.data)
|
||||||
}
|
}
|
||||||
|
}).catch(e => {
|
||||||
|
realTrendRef.value && realTrendRef.value.setRealTrendData(false)
|
||||||
|
harmonicSpectrumRef.value && harmonicSpectrumRef.value.setloading()
|
||||||
|
tableLoading.value = false
|
||||||
})
|
})
|
||||||
realTrendRef.value &&
|
await realTrendRef.value &&
|
||||||
realTrendRef.value.open({ devId: deviceId.value, lineId: lineId.value, activeTrendName: activeTrendName.value })
|
realTrendRef.value.open({ devId: deviceId.value, lineId: lineId.value, activeTrendName: activeTrendName.value })
|
||||||
}
|
}
|
||||||
//实时趋势
|
//实时趋势
|
||||||
@@ -699,6 +704,9 @@ const nodeClick = async (e: anyObj, node?: any) => {
|
|||||||
deviceType.value = '2'
|
deviceType.value = '2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//选中设备名称后,点击标签页也能查询数据,要求点击设备名称后,点击标签页默认查询第一个监测点数据
|
||||||
|
if (e.level == 3) {
|
||||||
searchValue.value = ''
|
searchValue.value = ''
|
||||||
|
|
||||||
deviceId.value = e?.pid
|
deviceId.value = e?.pid
|
||||||
@@ -709,8 +717,6 @@ const nodeClick = async (e: anyObj, node?: any) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//选中设备名称后,点击标签页也能查询数据,要求点击设备名称后,点击标签页默认查询第一个监测点数据
|
|
||||||
if (e.level == 3) {
|
|
||||||
engineeringName.value = node?.parent.parent.data.name
|
engineeringName.value = node?.parent.parent.data.name
|
||||||
|
|
||||||
await queryDictType({
|
await queryDictType({
|
||||||
|
|||||||
@@ -205,15 +205,17 @@ const buildTMetric = (name: string, items: RawMetricItem[]): DisplayMetric => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const sharedUnit = getSharedUnit(items)
|
const sharedUnit = getSharedUnit(items)
|
||||||
const unitsDiffer = sharedUnit == null && new Set(items.map(item => item.unit ?? null)).size > 1
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name,
|
name,
|
||||||
otherName: name,
|
otherName: name,
|
||||||
unit: getSharedUnit(items),
|
unit: sharedUnit,
|
||||||
type: 't-multi',
|
type: 't-multi',
|
||||||
subItems: items.map(item => ({
|
subItems: items.map(item => ({
|
||||||
subTitle: extractSubTitle(item.otherName || item.name || ''),
|
subTitle: buildTitle(
|
||||||
|
extractSubTitle(item.otherName || item.name || ''),
|
||||||
|
item.unit
|
||||||
|
),
|
||||||
value: item.data,
|
value: item.data,
|
||||||
})),
|
})),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
<Table ref="tableRef"></Table>
|
<Table ref="tableRef"></Table>
|
||||||
|
|
||||||
<el-dialog :title="dialogTitle" v-model.trim="dialogFormVisible" :close-on-click-modal="false"
|
<el-dialog :title="dialogTitle" v-model.trim="dialogFormVisible" :close-on-click-modal="false"
|
||||||
:before-close="resetForm" draggable width="40%">
|
:before-close="resetForm" draggable width="500px">
|
||||||
<el-form :model="form" label-width="120px" :rules="rules" ref="ruleFormRef">
|
<el-form :model="form" label-width="120px" :rules="rules" ref="ruleFormRef">
|
||||||
<el-form-item label="设备名称:" prop="name">
|
<el-form-item label="设备名称:" prop="name">
|
||||||
<el-input maxlength="32" show-word-limit v-model.trim="form.name" autocomplete="off" clearable
|
<el-input maxlength="32" show-word-limit v-model.trim="form.name" autocomplete="off" clearable
|
||||||
|
|||||||
@@ -281,6 +281,9 @@ const resetData = (dataLevel: string) => {
|
|||||||
allDataList.value = []
|
allDataList.value = []
|
||||||
xAixsTimeList.value = []
|
xAixsTimeList.value = []
|
||||||
}
|
}
|
||||||
|
const setloading=()=>{
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
resetData('Primary')
|
resetData('Primary')
|
||||||
const mqttMessage: any = ref()
|
const mqttMessage: any = ref()
|
||||||
const setHarmonicSpectrumData = (val: any) => {
|
const setHarmonicSpectrumData = (val: any) => {
|
||||||
@@ -414,7 +417,7 @@ const init = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => { })
|
onMounted(() => { })
|
||||||
defineExpose({ resetData, setHarmonicSpectrumData })
|
defineExpose({ resetData, setHarmonicSpectrumData,setloading })
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.harmonic {
|
.harmonic {
|
||||||
|
|||||||
@@ -277,6 +277,7 @@ const init = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const handleClick = (tab: any, event: any) => {
|
const handleClick = (tab: any, event: any) => {
|
||||||
tableData.value = []
|
tableData.value = []
|
||||||
echartsData.value = {}
|
echartsData.value = {}
|
||||||
@@ -305,6 +306,7 @@ const shouldIncludeHarmonicData = (numberPart: number) => {
|
|||||||
const setRealTrendData = (val: any) => {
|
const setRealTrendData = (val: any) => {
|
||||||
mqttMessage.value = {}
|
mqttMessage.value = {}
|
||||||
if (!val) {
|
if (!val) {
|
||||||
|
loading.value = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
loading.value = true
|
loading.value = true
|
||||||
@@ -338,24 +340,24 @@ const selectChange = () => {
|
|||||||
//获取国标限值
|
//获取国标限值
|
||||||
const limitData: any = ref()
|
const limitData: any = ref()
|
||||||
const setOverLimitData = (val: any) => {
|
const setOverLimitData = (val: any) => {
|
||||||
limitData.value = {}
|
// limitData.value = {}
|
||||||
for (let key in val) {
|
// for (let key in val) {
|
||||||
if (activeName.value == 0) {
|
// if (activeName.value == 0) {
|
||||||
if (String(key).includes('uharm')) {
|
// if (String(key).includes('uharm')) {
|
||||||
if (key.startsWith('uharm')) {
|
// if (key.startsWith('uharm')) {
|
||||||
limitData.value[key] = val[key]
|
// limitData.value[key] = val[key]
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} else if (activeName.value == 1) {
|
// } else if (activeName.value == 1) {
|
||||||
if (String(key).includes('iharm')) {
|
// if (String(key).includes('iharm')) {
|
||||||
limitData.value[key] = val[key]
|
// limitData.value[key] = val[key]
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
if (String(key).includes('inuharm')) {
|
// if (String(key).includes('inuharm')) {
|
||||||
limitData.value[key] = val[key]
|
// limitData.value[key] = val[key]
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
onMounted(() => {})
|
onMounted(() => {})
|
||||||
defineExpose({ open, setRealTrendData, setOverLimitData })
|
defineExpose({ open, setRealTrendData, setOverLimitData })
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
</vxe-column>
|
</vxe-column>
|
||||||
|
|
||||||
</vxe-table>
|
</vxe-table>
|
||||||
<el-dialog draggable v-model="dialogVisible" title="修改" width="400" :before-close="handleClose">
|
<el-dialog draggable v-model="dialogVisible" title="修改" width="500" :before-close="handleClose">
|
||||||
<el-form :model="form" ref="ruleFormRef" label-width="auto" class="form-one" :rules="rules">
|
<el-form :model="form" ref="ruleFormRef" label-width="auto" class="form-one" :rules="rules">
|
||||||
<el-form-item label="数据起始时间" prop="proStartTime">
|
<el-form-item label="数据起始时间" prop="proStartTime">
|
||||||
<el-date-picker v-model="form.proStartTime" type="datetime" format="YYYY-MM-DD HH:mm:ss"
|
<el-date-picker v-model="form.proStartTime" type="datetime" format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
title="绑定工程"
|
title="绑定工程"
|
||||||
class="cn-operate-dialog"
|
class="cn-operate-dialog"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
|
width="500px"
|
||||||
>
|
>
|
||||||
<el-input maxlength="32" show-word-limit
|
<el-input maxlength="32" show-word-limit
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,7 @@
|
|||||||
<!-- <el-empty v-if="dirList.length === 0" /> -->
|
<!-- <el-empty v-if="dirList.length === 0" /> -->
|
||||||
</div>
|
</div>
|
||||||
<popup ref="fileRef"></popup>
|
<popup ref="fileRef"></popup>
|
||||||
<el-dialog v-model.trim="addDeviceDirOpen" :destroy-on-close="true" title="新建文件夹目录" width="500" @closed="close">
|
<el-dialog v-model.trim="addDeviceDirOpen" draggable :destroy-on-close="true" title="新建文件夹目录" width="500" @closed="close">
|
||||||
<el-form ref="formRef" :model="form"
|
<el-form ref="formRef" :model="form"
|
||||||
:rules="{ path: [{ required: true, message: '请输入文件夹名称', trigger: 'blur' }] }">
|
:rules="{ path: [{ required: true, message: '请输入文件夹名称', trigger: 'blur' }] }">
|
||||||
<el-form-item label="文件夹名称" prop="path">
|
<el-form-item label="文件夹名称" prop="path">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<!-- 设备文件下载 -->
|
<!-- 设备文件下载 -->
|
||||||
<template>
|
<template>
|
||||||
<div :class="downLoading ? 'all_disabled' : ''">
|
<div :class="downLoading ? 'all_disabled' : ''">
|
||||||
<el-dialog v-model.trim="dialogVisible" title="文件信息" width="50%" @closed="handleClose">
|
<el-dialog draggable v-model.trim="dialogVisible" title="文件信息" width="800px" @closed="handleClose">
|
||||||
<div v-loading="loading">
|
<div v-loading="loading">
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog class="cn-operate-dialog device-manage-popup" v-model.trim="dialogVisible" title="设备模版分组">
|
<el-dialog draggable class="cn-operate-dialog device-manage-popup" v-model.trim="dialogVisible" title="设备模版分组" width="500px">
|
||||||
<el-descriptions class="mb10" :column="3" border>
|
<el-descriptions class="mb10" :column="3" border>
|
||||||
<el-descriptions-item label="名称">
|
<el-descriptions-item label="名称">
|
||||||
{{ popupData.deviceData.name }}
|
{{ popupData.deviceData.name }}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
draggable
|
draggable
|
||||||
title="绑定工程 / 设备"
|
title="绑定工程 / 设备"
|
||||||
class="cn-operate-dialog"
|
class="cn-operate-dialog"
|
||||||
|
width="800px"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
>
|
>
|
||||||
<div class="dialog-content">
|
<div class="dialog-content">
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model.trim="dialogVisible" :title="title" draggable
|
<el-dialog
|
||||||
:style="{ width: popupType == 0 || popupType == 1 ? '500px' : '1100px' }">
|
:width="(popupType == 0 || popupType == 1) ? '500px' : (popupType == 2 || popupType == 3) ? '800px' : '1100px'"
|
||||||
|
v-model.trim="dialogVisible" :title="title" draggable>
|
||||||
<!-- 新增方案数据 -->
|
<!-- 新增方案数据 -->
|
||||||
<el-form :model="form" scroll-to-error label-width="140px" :rules="rules1" ref="ruleFormRef1" class="form-one"
|
<el-form :model="form" scroll-to-error label-width="140px" :rules="rules1" ref="ruleFormRef1" class="form-one"
|
||||||
v-if="popupType == 0 || popupType == 1">
|
v-if="popupType == 0 || popupType == 1">
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog class="cn-operate-dialog" draggable v-model.trim="dialogVisible" width="900px" :title="title" @close="emit('close')">
|
<el-dialog class="cn-operate-dialog" draggable v-model.trim="dialogVisible" width="800px" :title="title" @close="emit('close')">
|
||||||
<el-scrollbar>
|
<el-scrollbar>
|
||||||
<div style="padding-left: 50px">
|
<div style="padding-left: 50px">
|
||||||
<el-divider content-position="center">基础数据</el-divider>
|
<el-divider content-position="center">基础数据</el-divider>
|
||||||
|
|||||||
@@ -1,41 +1,42 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog draggable class="cn-operate-dialog" width="540px" v-model.trim="dialogVisible" :title="title">
|
<el-dialog draggable class="cn-operate-dialog" width="540px" v-model.trim="dialogVisible" :title="title">
|
||||||
|
<div style="height: 300px;overflow-y: auto;">
|
||||||
<el-form :inline="false" ref="formRef" :model="form" label-width="auto" class="form-one" :rules="rules">
|
<el-form :inline="false" ref="formRef" :model="form" label-width="auto" class="form-one" :rules="rules">
|
||||||
<el-form-item label="项目名称" prop="name">
|
<el-form-item label="项目名称" prop="name">
|
||||||
<el-input maxlength="32" show-word-limit v-model.trim="form.name" placeholder="请输入项目名称" />
|
<el-input maxlength="32" show-word-limit v-model.trim="form.name" placeholder="请输入项目名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="所属工程" prop="engineeringId">
|
<el-form-item label="所属工程" prop="engineeringId">
|
||||||
<el-select v-model="form.engineeringId" filterable placeholder="请选择工程" clearable>
|
<el-select v-model="form.engineeringId" filterable placeholder="请选择工程" clearable>
|
||||||
<el-option
|
<el-option v-for="item in engineeringList" :key="item.engineeringId"
|
||||||
v-for="item in engineeringList"
|
:label="item.engineeringName" :value="item.engineeringId" />
|
||||||
:key="item.engineeringId"
|
|
||||||
:label="item.engineeringName"
|
|
||||||
:value="item.engineeringId"
|
|
||||||
/>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="区域" prop="area">
|
<el-form-item label="区域" prop="area">
|
||||||
<el-input maxlength="32" show-word-limit v-model="form.area" clearable placeholder="请输入区域" />
|
<el-input maxlength="32" show-word-limit v-model="form.area" clearable placeholder="请输入区域" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="description">
|
<el-form-item label="备注" prop="description">
|
||||||
<el-input maxlength="300" show-word-limit v-model="form.description" :rows="2" type="textarea" clearable placeholder="请输入备注" />
|
<el-input maxlength="300" show-word-limit v-model="form.description" :rows="2" type="textarea"
|
||||||
|
clearable placeholder="请输入备注" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="排序" prop="sort">
|
<el-form-item label="排序" prop="sort">
|
||||||
<el-input-number v-model.number="form.sort" style="width: 100%;" :min="0" />
|
<el-input-number v-model.number="form.sort" style="width: 100%;" :min="0" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="拓扑图">
|
<el-form-item label="拓扑图">
|
||||||
<div class="image-radio-group">
|
<div class="image-radio-group">
|
||||||
<div class="image-radio-item" v-for="item in images" :key="item.id" @click="handleSelect(item.id)">
|
<div class="image-radio-item" v-for="item in images" :key="item.id"
|
||||||
|
@click="handleSelect(item.id)">
|
||||||
<el-radio :label="item.id" v-model="form.topoIds" class="hidden-radio">
|
<el-radio :label="item.id" v-model="form.topoIds" class="hidden-radio">
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
</el-radio>
|
</el-radio>
|
||||||
<div class="image-container" :class="{ selected: form.topoIds === item.id }">
|
<div class="image-container" :class="{ selected: form.topoIds === item.id }">
|
||||||
<img :src="item.url" v-if="item.url" class="image-preview" />
|
<img :src="item.url" v-if="item.url" class="image-preview" />
|
||||||
<div v-else style="width: 120px; height: 90px; text-align: center; line-height: 90px">
|
<div v-else style="width: 110px; height: 70px; text-align: center; line-height: 70px">
|
||||||
暂无图片
|
暂无图片
|
||||||
</div>
|
</div>
|
||||||
<div class="image-overlay" v-if="form.topoIds === item.id">
|
<div class="image-overlay" v-if="form.topoIds === item.id">
|
||||||
<el-icon class="check-icon"><Check /></el-icon>
|
<el-icon class="check-icon">
|
||||||
|
<Check />
|
||||||
|
</el-icon>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="image-name">{{ item.name }}</div>
|
<div class="image-name">{{ item.name }}</div>
|
||||||
@@ -43,6 +44,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
@@ -189,8 +191,8 @@ defineExpose({ open })
|
|||||||
}
|
}
|
||||||
|
|
||||||
.image-preview {
|
.image-preview {
|
||||||
width: 120px;
|
width: 110px;
|
||||||
height: 90px;
|
height: 70px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.image-overlay {
|
.image-overlay {
|
||||||
@@ -213,9 +215,12 @@ defineExpose({ open })
|
|||||||
.image-name {
|
.image-name {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
width: 120px;
|
width: 110px;
|
||||||
white-space: nowrap; /* 强制文字单行显示,不换行 */
|
white-space: nowrap;
|
||||||
overflow: hidden; /* 隐藏超出容器的文字 */
|
/* 强制文字单行显示,不换行 */
|
||||||
text-overflow: ellipsis; /* 超出部分显示省略号(点点点) */
|
overflow: hidden;
|
||||||
|
/* 隐藏超出容器的文字 */
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
/* 超出部分显示省略号(点点点) */
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -90,8 +90,8 @@
|
|||||||
</TableHeader>
|
</TableHeader>
|
||||||
<Table ref="tableRef" :checkbox-config="checkboxConfig" :key="tableKey" @sort-change="handleSortChange"></Table>
|
<Table ref="tableRef" :checkbox-config="checkboxConfig" :key="tableKey" @sort-change="handleSortChange"></Table>
|
||||||
|
|
||||||
<FactoryForm ref="factoryFormRef" :engineering-list="engineeringList"
|
<FactoryForm ref="factoryFormRef" :engineering-list="engineeringList" :dev-type-options="devTypeOptions"
|
||||||
:dev-type-options="devTypeOptions" :dev-type-options2="devTypeOptions2" :dev-model-options="devModelOptions"
|
:dev-type-options2="devTypeOptions2" :dev-model-options="devModelOptions"
|
||||||
:dev-model-options2="devModelOptions2" @success="onFormSuccess" />
|
:dev-model-options2="devModelOptions2" @success="onFormSuccess" />
|
||||||
|
|
||||||
<div class="qrcode-label">
|
<div class="qrcode-label">
|
||||||
@@ -126,6 +126,7 @@ import {
|
|||||||
resetFactory,
|
resetFactory,
|
||||||
portableDeviceRegister,
|
portableDeviceRegister,
|
||||||
portableDeviceAccess,
|
portableDeviceAccess,
|
||||||
|
accessByUpdateMac
|
||||||
} from '@/api/cs-system-boot/device'
|
} from '@/api/cs-system-boot/device'
|
||||||
import html2canvas from 'html2canvas'
|
import html2canvas from 'html2canvas'
|
||||||
import { fullUrl } from '@/utils/common'
|
import { fullUrl } from '@/utils/common'
|
||||||
@@ -364,102 +365,7 @@ const tableStore = new TableStore({
|
|||||||
width: 180,
|
width: 180,
|
||||||
render: 'buttons',
|
render: 'buttons',
|
||||||
buttons: [
|
buttons: [
|
||||||
//直连设备注册
|
|
||||||
// {
|
|
||||||
// title: '注册',
|
|
||||||
// type: 'primary',
|
|
||||||
// icon: 'el-icon-Grid',
|
|
||||||
// render: 'basicButton',
|
|
||||||
// disabled: row => {
|
|
||||||
// return (
|
|
||||||
// (row.devType == '8b45cf6b7f5266e777d07c166ad5fa77' &&
|
|
||||||
// row.devModel == 'a0d4da4b5c17b2172362a3f5a27bf217') ||
|
|
||||||
// row.status == '1'
|
|
||||||
// )
|
|
||||||
// },
|
|
||||||
// click: row => {
|
|
||||||
// // 直连设备注册
|
|
||||||
// ElMessageBox.confirm('确定注册该设备吗?', '提示', {
|
|
||||||
// confirmButtonText: '确认',
|
|
||||||
// cancelButtonText: '取消',
|
|
||||||
// type: 'warning'
|
|
||||||
// })
|
|
||||||
// .then(() => {
|
|
||||||
// governDeviceRegister({
|
|
||||||
// nDid: row.ndid,
|
|
||||||
// type: '4'
|
|
||||||
// }).then(res => {
|
|
||||||
// ElMessage.success(res.message)
|
|
||||||
// tableStore.onTableAction('search', {})
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// .catch(e => {})
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// //便携式设备注册
|
|
||||||
// {
|
|
||||||
// title: '注册',
|
|
||||||
// type: 'primary',
|
|
||||||
// icon: 'el-icon-Grid',
|
|
||||||
// render: 'basicButton',
|
|
||||||
// disabled: row => {
|
|
||||||
// // return (
|
|
||||||
// // (row.devType != '8b45cf6b7f5266e777d07c166ad5fa77' &&
|
|
||||||
// // row.devModel != 'a0d4da4b5c17b2172362a3f5a27bf217') ||
|
|
||||||
// // row.status != '1'
|
|
||||||
// // )
|
|
||||||
// return true
|
|
||||||
// },
|
|
||||||
// click: row => {
|
|
||||||
// // 便携式设备注册
|
|
||||||
// ElMessageBox.confirm('确定注册该设备吗?', '提示', {
|
|
||||||
// confirmButtonText: '确认',
|
|
||||||
// cancelButtonText: '取消',
|
|
||||||
// type: 'warning'
|
|
||||||
// })
|
|
||||||
// .then(() => {
|
|
||||||
// portableDeviceRegister({
|
|
||||||
// nDid: row.ndid
|
|
||||||
// }).then(res => {
|
|
||||||
// ElMessage.success(res.message)
|
|
||||||
// tableStore.index()
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// .catch(e => {})
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
//直连设备接入
|
|
||||||
// {
|
|
||||||
// title: '接入',
|
|
||||||
// type: 'primary',
|
|
||||||
// icon: 'el-icon-Grid',
|
|
||||||
// render: 'basicButton',
|
|
||||||
// disabled: row => {
|
|
||||||
// return (
|
|
||||||
// (row.devType == '8b45cf6b7f5266e777d07c166ad5fa77' &&
|
|
||||||
// row.devModel == 'a0d4da4b5c17b2172362a3f5a27bf217') ||
|
|
||||||
// row.status != '2'
|
|
||||||
// )
|
|
||||||
// },
|
|
||||||
// click: row => {
|
|
||||||
// // 直连设备接入
|
|
||||||
// ElMessageBox.confirm('确定接入该设备吗?', '提示', {
|
|
||||||
// confirmButtonText: '确认',
|
|
||||||
// cancelButtonText: '取消',
|
|
||||||
// type: 'warning'
|
|
||||||
// })
|
|
||||||
// .then(() => {
|
|
||||||
// governDeviceRegister({
|
|
||||||
// nDid: row.ndid,
|
|
||||||
// type: '4'
|
|
||||||
// }).then(res => {
|
|
||||||
// ElMessage.success(res.message)
|
|
||||||
// tableStore.onTableAction('search', {})
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// .catch(e => {})
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// 在线设备注册
|
// 在线设备注册
|
||||||
{
|
{
|
||||||
title: '接入',
|
title: '接入',
|
||||||
@@ -469,9 +375,9 @@ const tableStore = new TableStore({
|
|||||||
loading: 'loading1',
|
loading: 'loading1',
|
||||||
disabled: row => {
|
disabled: row => {
|
||||||
return !(
|
return !(
|
||||||
row.devType == '123202e523be2b8defc8d0c2f118f232' &&
|
(row.devType == '123202e523be2b8defc8d0c2f118f232' || row.devType != '8b45cf6b7f5266e777d07c166ad5fa77') &&
|
||||||
row.associatedProject != null &&
|
row.associatedProject != null &&
|
||||||
row.status != 3
|
(row.status == 5 || row.isAccess == 0)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
click: row => {
|
click: row => {
|
||||||
@@ -483,6 +389,9 @@ const tableStore = new TableStore({
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
row.loading1 = true
|
row.loading1 = true
|
||||||
|
|
||||||
|
if (row.status == 5) {
|
||||||
|
// 在线设备注册
|
||||||
|
if (row.devType == '123202e523be2b8defc8d0c2f118f232') {
|
||||||
onlineRegister({
|
onlineRegister({
|
||||||
projectId: row.associatedProject,
|
projectId: row.associatedProject,
|
||||||
nDid: row.ndid
|
nDid: row.ndid
|
||||||
@@ -495,45 +404,75 @@ const tableStore = new TableStore({
|
|||||||
.catch(() => {
|
.catch(() => {
|
||||||
row.loading1 = false
|
row.loading1 = false
|
||||||
})
|
})
|
||||||
})
|
} else {
|
||||||
}
|
// //便携式设备手动接入
|
||||||
},
|
portableDeviceRegister({
|
||||||
//便携式设备手动接入
|
|
||||||
{
|
|
||||||
title: '接入',
|
|
||||||
type: 'primary',
|
|
||||||
icon: 'el-icon-Grid',
|
|
||||||
render: 'basicButton',
|
|
||||||
loading: 'loading1',
|
|
||||||
disabled: row => {
|
|
||||||
return (
|
|
||||||
(row.devType != '8b45cf6b7f5266e777d07c166ad5fa77' &&
|
|
||||||
row.devModel != 'a0d4da4b5c17b2172362a3f5a27bf217') ||
|
|
||||||
row.status != '6'
|
|
||||||
)
|
|
||||||
},
|
|
||||||
click: row => {
|
|
||||||
// 便携式设备手动接入
|
|
||||||
ElMessageBox.confirm('确定接入该设备吗?', '提示', {
|
|
||||||
confirmButtonText: '确认',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning'
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
row.loading1 = true
|
|
||||||
portableDeviceAccess({
|
|
||||||
nDid: row.ndid
|
nDid: row.ndid
|
||||||
}).then(res => {
|
|
||||||
ElMessage.success(res.message)
|
|
||||||
row.loading1 = false
|
|
||||||
tableStore.index()
|
|
||||||
})
|
})
|
||||||
|
.then(res => {
|
||||||
|
row.loading1 = false
|
||||||
|
ElMessage.success(res.message)
|
||||||
|
tableStore.index()
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
row.loading1 = false
|
row.loading1 = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
accessByUpdateMac({
|
||||||
|
nDid: row.ndid
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
row.loading1 = false
|
||||||
|
ElMessage.success(res.message)
|
||||||
|
tableStore.index()
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
row.loading1 = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
//便携式设备手动接入
|
||||||
|
// {
|
||||||
|
// title: '接入',
|
||||||
|
// type: 'primary',
|
||||||
|
// icon: 'el-icon-Grid',
|
||||||
|
// render: 'basicButton',
|
||||||
|
// loading: 'loading1',
|
||||||
|
// disabled: row => {
|
||||||
|
// return (
|
||||||
|
// (row.devType != '8b45cf6b7f5266e777d07c166ad5fa77' &&
|
||||||
|
// row.devModel != 'a0d4da4b5c17b2172362a3f5a27bf217') ||
|
||||||
|
// row.status != '6'
|
||||||
|
// )
|
||||||
|
// },
|
||||||
|
// click: row => {
|
||||||
|
// // 便携式设备手动接入
|
||||||
|
// ElMessageBox.confirm('确定接入该设备吗?', '提示', {
|
||||||
|
// confirmButtonText: '确认',
|
||||||
|
// cancelButtonText: '取消',
|
||||||
|
// type: 'warning'
|
||||||
|
// })
|
||||||
|
// .then(() => {
|
||||||
|
// row.loading1 = true
|
||||||
|
// portableDeviceAccess({
|
||||||
|
// nDid: row.ndid
|
||||||
|
// }).then(res => {
|
||||||
|
// ElMessage.success(res.message)
|
||||||
|
// row.loading1 = false
|
||||||
|
// tableStore.index()
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
// .catch(e => {
|
||||||
|
// row.loading1 = false
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
title: '接入',
|
title: '接入',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog class="cn-operate-dialog" v-model.trim="dialogVisible" title="编辑拓扑图信息">
|
<el-dialog draggable class="cn-operate-dialog" v-model.trim="dialogVisible" title="编辑拓扑图信息" width="800px">
|
||||||
<el-form :label-width="140">
|
<el-form :label-width="140">
|
||||||
<el-form-item label="拓扑图:" style="height: auto !important" class="form-one">
|
<el-form-item label="拓扑图:" style="height: auto !important" class="form-one">
|
||||||
<div class="gplot-content">
|
<div class="gplot-content">
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class='default-main'>
|
<div class="default-main">
|
||||||
<el-tabs v-model.trim='activeName' type='border-card' @tab-click='init'>
|
<el-tabs v-model.trim="activeName" type="border-card" @tab-change="loadTabContent">
|
||||||
<el-tab-pane label='用户协议' name='User_Agreement'></el-tab-pane>
|
<el-tab-pane label="用户协议" name="User_Agreement"></el-tab-pane>
|
||||||
<el-tab-pane label='个人信息保护政策' name='Personal_Infor_Protect'></el-tab-pane>
|
<el-tab-pane label="个人信息保护政策" name="Personal_Infor_Protect"></el-tab-pane>
|
||||||
<el-tab-pane label='系统介绍' name='introduction'></el-tab-pane>
|
<el-tab-pane label="系统介绍" name="introduction"></el-tab-pane>
|
||||||
<el-tab-pane label='使用手册' name='User_Manual'></el-tab-pane>
|
<el-tab-pane label="使用手册" name="User_Manual"></el-tab-pane>
|
||||||
<el-tab-pane label='公司介绍' name='Company_Profile'></el-tab-pane>
|
<el-tab-pane label="公司介绍" name="Company_Profile"></el-tab-pane>
|
||||||
<div class='agreement' :style='{ height: height }'>
|
<div class="agreement" :style="{ height: height }">
|
||||||
<div style='margin-top: 5px; right: 10px; position: absolute; z-index: 9999999'>
|
<div style="margin-top: 5px; right: 10px; position: absolute; z-index: 9999999">
|
||||||
<el-button type='primary' @click='submit' icon='el-icon-Checked'>保存</el-button>
|
<el-button type="primary" @click="submit" icon="el-icon-Checked">保存</el-button>
|
||||||
</div>
|
</div>
|
||||||
<WangEditor v-model.trim='html' style='border-top: none' />
|
<WangEditor v-if="editorVisible" :key="activeName" v-model="html" style="border-top: none" />
|
||||||
</div>
|
</div>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='ts'>
|
<script setup lang="ts">
|
||||||
import { ref, nextTick } from 'vue'
|
import { ref, nextTick } from 'vue'
|
||||||
import { mainHeight } from '@/utils/layout'
|
import { mainHeight } from '@/utils/layout'
|
||||||
import { useDictData } from '@/stores/dictData'
|
import { useDictData } from '@/stores/dictData'
|
||||||
@@ -28,33 +28,47 @@ import { ElMessage } from 'element-plus'
|
|||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'govern/setting/app'
|
name: 'govern/setting/app'
|
||||||
})
|
})
|
||||||
|
|
||||||
const dic = useDictData().getBasicData('appInformationType')
|
const dic = useDictData().getBasicData('appInformationType')
|
||||||
const id = ref('')
|
const id = ref('')
|
||||||
const activeName = ref('User_Agreement')
|
const activeName = ref('User_Agreement')
|
||||||
const html = ref('')
|
const html = ref('')
|
||||||
|
const editorVisible = ref(false)
|
||||||
const height = mainHeight(80).height
|
const height = mainHeight(80).height
|
||||||
|
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
addAppInfo({
|
addAppInfo({
|
||||||
type: id.value,
|
type: id.value,
|
||||||
content: html.value
|
content: html.value
|
||||||
}).then((res) => {
|
}).then(() => {
|
||||||
ElMessage.success('保存成功')
|
ElMessage.success('保存成功')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const init = () => {
|
|
||||||
nextTick(() => {
|
|
||||||
dic.forEach((item: BasicDictData) => {
|
|
||||||
if (item.code == activeName.value) {
|
|
||||||
|
|
||||||
|
const loadTabContent = async (paneName: string | number) => {
|
||||||
|
editorVisible.value = false
|
||||||
|
await nextTick()
|
||||||
|
await nextTick()
|
||||||
|
|
||||||
id.value = item.id
|
const matched = dic.find((item: BasicDictData) => item.code === String(paneName))
|
||||||
|
if (!matched) {
|
||||||
|
id.value = ''
|
||||||
|
html.value = ''
|
||||||
|
editorVisible.value = true
|
||||||
|
return
|
||||||
}
|
}
|
||||||
})
|
|
||||||
queryAppInfo(id.value).then((res: any) => {
|
|
||||||
html.value = res.data.content
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
init()
|
|
||||||
|
|
||||||
|
id.value = matched.id
|
||||||
|
try {
|
||||||
|
const res: any = await queryAppInfo(id.value)
|
||||||
|
html.value = res.data?.content ?? ''
|
||||||
|
} catch {
|
||||||
|
html.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
await nextTick()
|
||||||
|
editorVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
loadTabContent(activeName.value)
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog width="500px" v-model.trim="dialogVisible" :title="title">
|
<el-dialog draggable width="500px" v-model.trim="dialogVisible" :title="title">
|
||||||
<el-form :model="form" ref="formRef" class="form-one" label-width="auto" :rules="rules">
|
<el-form :model="form" ref="formRef" class="form-one" label-width="auto" :rules="rules">
|
||||||
<el-form-item label="名称" prop="name">
|
<el-form-item label="名称" prop="name">
|
||||||
<el-input maxlength="32" show-word-limit v-model.trim="form.name" placeholder="请输入名称" />
|
<el-input maxlength="32" show-word-limit v-model.trim="form.name" placeholder="请输入名称" />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog draggable class="cn-operate-dialog statistical-type-binding" v-model.trim="dialogVisible" title="绑定指标"
|
<el-dialog draggable class="cn-operate-dialog statistical-type-binding" v-model.trim="dialogVisible" title="绑定指标"
|
||||||
style="width: 1200px" @closed="close">
|
width="1200px" @closed="close">
|
||||||
<el-scrollbar style="padding-right: 0">
|
<el-scrollbar style="padding-right: 0">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="box-left">
|
<div class="box-left">
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
@close="cancel"
|
@close="cancel"
|
||||||
>
|
>
|
||||||
<div style="display: flex">
|
<div style="display: flex">
|
||||||
<el-form :inline="false" :model="form" label-width="auto" :rules="rules" ref="formRef" style="flex: 1">
|
<el-form :inline="false" :model="form" label-width="auto" :rules="rules" ref="formRef" style="width: 400px;">
|
||||||
<el-form-item class="top" label="组件名称" prop="name">
|
<el-form-item class="top" label="组件名称" prop="name">
|
||||||
<el-input maxlength="32" show-word-limit v-model="form.name" placeholder="请输入组件名称"></el-input>
|
<el-input maxlength="32" show-word-limit v-model="form.name" placeholder="请输入组件名称"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
<el-input-number v-model.number="form.sort" style="width: 100%;" :min="0" />
|
<el-input-number v-model.number="form.sort" style="width: 100%;" :min="0" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="width: 600px; height: 390px; overflow: hidden">
|
<div style="flex: 1; width: 600px; height: 390px; overflow: hidden">
|
||||||
<div class="ml10" style="font-weight: 600">组件展示</div>
|
<div class="ml10" style="font-weight: 600">组件展示</div>
|
||||||
<component
|
<component
|
||||||
:is="registerComponent(form.path)"
|
:is="registerComponent(form.path)"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog width='600px' v-model.trim='dialogVisible' :title='title'>
|
<el-dialog width='500px' v-model.trim='dialogVisible' :title='title'>
|
||||||
<el-scrollbar>
|
<el-scrollbar>
|
||||||
<el-form :inline='false' :model='form' label-width='auto' class="form-one" :rules='rules' ref='formRef'>
|
<el-form :inline='false' :model='form' label-width='auto' class="form-one" :rules='rules' ref='formRef'>
|
||||||
<el-form-item label='名称' prop='name'>
|
<el-form-item label='名称' prop='name'>
|
||||||
@@ -9,9 +9,7 @@
|
|||||||
<el-input maxlength="32" show-word-limit v-model.trim='form.code' placeholder="请输入字典编码"></el-input>
|
<el-input maxlength="32" show-word-limit v-model.trim='form.code' placeholder="请输入字典编码"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label='排序' class='top' prop='sort'>
|
|
||||||
<el-input-number v-model.trim="form.sort" :min="0" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label='开启等级' class='top'>
|
<el-form-item label='开启等级' class='top'>
|
||||||
<el-select v-model.trim='form.openLevel' placeholder='选择开启等级'>
|
<el-select v-model.trim='form.openLevel' placeholder='选择开启等级'>
|
||||||
<el-option v-for='item in OpenLevel' :key='item.value' :label='item.label' :value='item.value'>
|
<el-option v-for='item in OpenLevel' :key='item.value' :label='item.label' :value='item.value'>
|
||||||
@@ -29,6 +27,9 @@
|
|||||||
<el-input show-word-limit maxlength="300" v-model.trim='form.remark' placeholder='请输入字典描述'
|
<el-input show-word-limit maxlength="300" v-model.trim='form.remark' placeholder='请输入字典描述'
|
||||||
type='textarea' :rows='2'></el-input>
|
type='textarea' :rows='2'></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label='排序' class='top' prop='sort'>
|
||||||
|
<el-input-number v-model.trim="form.sort" :min="0" style="width: 100%;"/>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
|
|
||||||
|
|||||||
@@ -41,11 +41,11 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="Android路径:" prop="androidPath" v-if="form.versionType == 'APP'">
|
<el-form-item label="Android路径:" prop="androidPath" v-if="form.versionType == 'APP'">
|
||||||
<el-input maxlength="32" show-word-limit v-model.trim="form.androidPath"
|
<el-input v-model.trim="form.androidPath"
|
||||||
placeholder="请输入Android路径" />
|
placeholder="请输入Android路径" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="IOS路径:" prop="iosPath" v-if="form.versionType == 'APP'">
|
<el-form-item label="IOS路径:" prop="iosPath" v-if="form.versionType == 'APP'">
|
||||||
<el-input maxlength="32" show-word-limit v-model.trim="form.iosPath" placeholder="请输入IOS路径" />
|
<el-input v-model.trim="form.iosPath" placeholder="请输入IOS路径" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user