添加mqtt链接展示

This commit is contained in:
GGJ
2025-04-28 15:51:30 +08:00
parent adc9b5a955
commit 9538b69310
4 changed files with 211 additions and 63 deletions

View File

@@ -13,8 +13,6 @@ import 'echarts-liquidfill'
import 'echarts/lib/component/dataZoom'
import { color, gradeColor3 } from './color'
import { useConfig } from '@/stores/config'
import { saveAs } from 'file-saver'
import { t } from 'vxe-table'
// import { nextTick } from 'process'
const config = useConfig()
@@ -119,7 +117,15 @@ const initChart = () => {
height: 13,
bottom: '20px',
end: 100
}
},
// {
// show: true,
// yAxisIndex: 0,
// width: 12,
// handleSize: 8,
// showDataShadow: false,
// right: 12
// }
],
color: props.options?.color || color,
series: props.options?.series,
@@ -177,7 +183,7 @@ const handlerYAxis = () => {
color: '#000',
fontSize: 14,
formatter: function (value) {
return value.toFixed(0) // 格式化显示为一位小数
return parseFloat(value.toFixed(1)) // 格式化显示为一位小数
}
},
splitLine: {
@@ -217,9 +223,9 @@ const handlerXAxis = () => {
// textStyle: {
fontFamily: 'dinproRegular',
color: '#000',
fontSize: '12',
fontSize: '12'
// }
},
}
// boundaryGap: false,
}
// props.options?.xAxis 是数组还是对象

View File

@@ -3,14 +3,27 @@
<Icon class="ba-icon-dark" v-if="field.render == 'icon'" :name="fieldValue ? fieldValue : field.default ?? ''" />
<!-- switch -->
<el-switch v-if="field.render == 'switch'" @change="onChangeField(field, $event)"
:model-value="fieldValue.toString()" :loading="row.loading" inline-prompt :active-value="field.activeValue"
:active-text="field.activeText" :inactive-value="field.inactiveValue" :inactive-text="field.inactiveText" />
<div v-if="field.render == 'switch' && fieldValue != undefined">
<el-switch
@change="onChangeField(field, $event)"
:model-value="fieldValue.toString()"
:loading="row.loading"
inline-prompt
:active-value="field.activeValue"
:active-text="field.activeText"
:inactive-value="field.inactiveValue"
:inactive-text="field.inactiveText"
/>
</div>
<!-- image -->
<div v-if="field.render == 'image' && fieldValue" class="ba-render-image">
<el-image :hide-on-click-modal="true" :preview-teleported="true" :preview-src-list="[fullUrl(fieldValue)]"
:src="fieldValue.length > 100 ? fieldValue : fullUrl(fieldValue)"></el-image>
<el-image
:hide-on-click-modal="true"
:preview-teleported="true"
:preview-src-list="[fullUrl(fieldValue)]"
:src="fieldValue.length > 100 ? fieldValue : fullUrl(fieldValue)"
></el-image>
</div>
<!-- tag -->
@@ -31,29 +44,55 @@
</div>
<!-- customTemplate 自定义模板 -->
<div v-if="field.render == 'customTemplate'"
v-html="field.customTemplate ? field.customTemplate(row, field, fieldValue, column, index) : ''"></div>
<div
v-if="field.render == 'customTemplate'"
v-html="field.customTemplate ? field.customTemplate(row, field, fieldValue, column, index) : ''"
></div>
<!-- 自定义组件/函数渲染 -->
<component v-if="field.render == 'customRender'" :is="field.customRender" :renderRow="row" :renderField="field"
:renderValue="fieldValue" :renderColumn="column" :renderIndex="index" />
<component
v-if="field.render == 'customRender'"
:is="field.customRender"
:renderRow="row"
:renderField="field"
:renderValue="fieldValue"
:renderColumn="column"
:renderIndex="index"
/>
<!-- 按钮组 -->
<div v-if="field.render == 'buttons' && buttons" class="cn-render-buttons">
<template v-for="(btn, idx) in buttons" :key="idx">
<!-- 常规按钮 -->
<el-button link v-if="btn.render == 'basicButton'" @click="onButtonClick(btn)" :class="btn.class"
class="table-operate" :type="btn.type" :loading="props.row[btn.loading] || props.row.loading || false"
v-bind="btn.attr">
<el-button
link
v-if="btn.render == 'basicButton'"
@click="onButtonClick(btn)"
:class="btn.class"
class="table-operate"
:type="btn.type"
:loading="props.row[btn.loading] || props.row.loading || false"
v-bind="btn.attr"
>
<div v-if="btn.text || btn.title" class="table-operate-text">{{ btn.text || btn.title }}</div>
</el-button>
<!-- 带提示信息的按钮 -->
<el-tooltip v-if="btn.render == 'tipButton'" :disabled="btn.title && !btn.disabledTip ? false : true"
:content="btn.title" placement="top">
<el-button link @click="onButtonClick(btn)" :class="btn.class" class="table-operate" :type="btn.type"
v-bind="btn.attr">
<el-tooltip
v-if="btn.render == 'tipButton'"
:disabled="btn.title && !btn.disabledTip ? false : true"
:content="btn.title"
placement="top"
>
<el-button
link
@click="onButtonClick(btn)"
:class="btn.class"
class="table-operate"
:type="btn.type"
v-bind="btn.attr"
>
<div v-if="btn.text || btn.title" class="table-operate-text">
{{ btn.text || btn.title }}
</div>
@@ -61,8 +100,12 @@
</el-tooltip>
<!-- 带确认框的按钮 -->
<el-popconfirm v-if="btn.render == 'confirmButton'" :disabled="btn.disabled && btn.disabled(row, field)"
v-bind="btn.popconfirm" @confirm="onButtonClick(btn)">
<el-popconfirm
v-if="btn.render == 'confirmButton'"
:disabled="btn.disabled && btn.disabled(row, field)"
v-bind="btn.popconfirm"
@confirm="onButtonClick(btn)"
>
<template #reference>
<div style="display: inline-block">
<el-button link :class="btn.class" class="table-operate" :type="btn.type" v-bind="btn.attr">
@@ -80,9 +123,14 @@
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item v-for="item in btn.buttons" :key="item.text" :command="item" :style="{
color: item.type === 'primary' ? 'var(--el-color-primary)' : 'var(--el-color-danger'
}">
<el-dropdown-item
v-for="item in btn.buttons"
:key="item.text"
:command="item"
:style="{
color: item.type === 'primary' ? 'var(--el-color-primary)' : 'var(--el-color-danger'
}"
>
{{ item.text }}
</el-dropdown-item>
</el-dropdown-menu>
@@ -230,7 +278,7 @@ const handlerCommand = (item: OptButton) => {
margin-left: 6px;
}
.ml-6+.el-button {
.ml-6 + .el-button {
margin-left: 6px;
}