修改遥测节点

dev_xq_0.0.1
谢庆 6 days ago
parent df16d67c14
commit 986bc85def

@ -199,7 +199,7 @@ leftAsideStore.registerConfig('vue四遥组件', [
}, },
showInfo: { showInfo: {
type: 'switch', type: 'switch',
val: true, val: false,
title: '显示详情' title: '显示详情'
}, },
location: { location: {
@ -261,6 +261,11 @@ leftAsideStore.registerConfig('vue四遥组件', [
val: '--', val: '--',
title: '绑定ID' title: '绑定ID'
}, },
showInfo: {
type: 'switch',
val: false,
title: '显示名称'
},
location: { location: {
type: 'select', type: 'select',
val: 'bottom', val: 'bottom',

@ -1,64 +1,4 @@
<template> <template>
<!-- <div style="display: flex; gap: 10px; align-items: center">
<el-popover
:width="300"
:visible="null"
popper-style="box-shadow: rgb(14 18 22 / 35%) 0px 10px 38px -10px, rgb(14 18 22 / 20%) 0px 10px 20px -15px; padding: 20px;"
>
<template #reference>
<el-text
style="font-weight: bold; text-align: center; display: block"
type="primary"
color="rgb(236, 245, 255)"
>
{{ computedVal }}
</el-text>
</template>
<template #default>
<div class="demo-rich-conent" style="display: flex; gap: 2px; flex-direction: column">
<div class="demo-progress">
<el-progress
type="dashboard"
:width="100"
:percentage="percentage"
:color="colors"
:format="customFormat"
/>
</div>
<el-row :gutter="6">
<el-col :span="12" :xs="24" :sm="12" :md="6" class="elColInfo">
<el-statistic title="绑定ID" :value="null">
<template #suffix>
<el-tag size="default" type="primary">{{ moduleId }}</el-tag>
</template>
</el-statistic>
</el-col>
<el-col :span="12" :xs="24" :sm="12" :md="12" class="elColInfo">
<el-statistic title="节点名称" :value="null">
<template #suffix>
<el-tag size="default" type="success">{{ modeName }}</el-tag>
</template>
</el-statistic>
</el-col>
<el-col :span="12" :xs="24" :sm="12" :md="6" class="elColInfo">
<el-statistic title="类型" :value="null">
<template #suffix>
<el-tag size="default" type="primary">{{ moduleType }}</el-tag>
</template>
</el-statistic>
</el-col>
</el-row>
</div>
</template>
</el-popover>
<el-tag type="primary">{{ modeName }}</el-tag>
</div> -->
<el-row v-if="location === 'top'"> <el-row v-if="location === 'top'">
<el-col :span="24" class="flex-center"> <el-col :span="24" class="flex-center">
<el-tag type="primary" size="small" style="opacity: 0.9"> <el-tag type="primary" size="small" style="opacity: 0.9">
@ -82,7 +22,7 @@
<div style="display: flex; gap: 10px; align-items: center"> <div style="display: flex; gap: 10px; align-items: center">
<el-popover <el-popover
:width="300" :width="300"
:disabled="true" :disabled="!showInfo"
popper-style="box-shadow: rgb(14 18 22 / 35%) 0px 10px 38px -10px, rgb(14 18 22 / 20%) 0px 10px 20px -15px; padding: 20px;" popper-style="box-shadow: rgb(14 18 22 / 35%) 0px 10px 38px -10px, rgb(14 18 22 / 20%) 0px 10px 20px -15px; padding: 20px;"
> >
<template #reference> <template #reference>
@ -188,6 +128,10 @@ const props = defineProps({
location: { location: {
type: String, type: String,
default: 'bottom' default: 'bottom'
},
showInfo: {
type: Boolean,
default: false
} }
}); });

@ -144,7 +144,6 @@ onUnmounted(() => {
emitter.off(props.definitionItemJson.id); emitter.off(props.definitionItemJson.id);
}); });
const props = defineProps({ const props = defineProps({
moduleType: { moduleType: {
type: String, type: String,

@ -0,0 +1,90 @@
const EnumTypeVal: [number, string][][] = [];
const EnumTypeValFun: ((val: number) => string)[] = [];
/**
*
* @param index
* @param type
* @returns {string|*}
*/
const trans = function (index: number, type: any[]) {
for (let i = 0; i < type.length; i++) {
if (type[i][0] == index) {
return type[i][1];
}
}
return "*未知*";
};
const EnumType = [
[0, '缺省'],
[1, '普通开关'],
[2, '数值'],
[3, '时间秒'],
[11, 'RY空调模式'],
[12, '空调温度'],
[13, '空调风速'],
[14, '国网空调模式'],
[21, 'KTC空调']
];
// 缺省
EnumTypeVal[0] = [
[0, '关闭'],
[1, '开启']
];
EnumTypeValFun[0] = function (val: number) {
return trans(val, EnumTypeVal[0])
}
// 遥控
EnumTypeVal[1] = [
[0, '关闭'],
[1, '开启']
];
EnumTypeValFun[1] = function (val) {
return trans(val, EnumTypeVal[1])
}
// 数值
EnumTypeVal[2] = [];
EnumTypeValFun[2] = function (val) {
return val.toString();
}
// timestamp 转换成时间
EnumTypeValFun[3] = function (val) {
return format(val * 1000, 'Y-m-d H:i:s')
}
export {EnumTypeVal,EnumTypeValFun}
const format = function(date: Date, format: string) {
var formatFunctions = formatFunctions;
if (!Ext.isDate(date)) {
return '';
}
if (formatFunctions[format] == null) {
utilDate.createFormat(format);
}
return formatFunctions[format].call(date) + '';
}
const formatFunctions: { [key: string]: () => string } = {
"MS": function() {
// UTC milliseconds since Unix epoch (MS-AJAX serialized date format (MRSF))
return '\\/Date(' + this.getTime() + ')\\/';
},
"time": function() {
return this.getTime().toString();
},
"timestamp": function() {
return format(this.getTime(), 'U');
}
}
Loading…
Cancel
Save