初始化

dev_xq_0.0.1
刘政 6 days ago
parent 726078fdef
commit b632834b07

@ -73,6 +73,7 @@ import VueGuagePieChart from '@/components/vue-components/echarts-pie-chart.vue'
// src\components\vue-components\vue-signal-monitoring.vue // src\components\vue-components\vue-signal-monitoring.vue
import VueSignalMonitoring from '@/components/vue-components/vue-signal-monitoring.vue'; import VueSignalMonitoring from '@/components/vue-components/vue-signal-monitoring.vue';
import VueImgImmobilization from '@/components/vue-components/vue-img-immobilization.vue'; import VueImgImmobilization from '@/components/vue-components/vue-img-immobilization.vue';
import VueCharacters from '@/components/vue-components/vue-characters.vue';
const instance = getCurrentInstance(); const instance = getCurrentInstance();
instance?.appContext.app.component('vue-my-button', VueMyButton); instance?.appContext.app.component('vue-my-button', VueMyButton);
@ -122,6 +123,7 @@ instance?.appContext.app.component('vue-guage-bar-chart', VueGuageBarChart);
instance?.appContext.app.component('vue-guage-pie-chart', VueGuagePieChart); instance?.appContext.app.component('vue-guage-pie-chart', VueGuagePieChart);
instance?.appContext.app.component('vue-img-immobilization', VueImgImmobilization); instance?.appContext.app.component('vue-img-immobilization', VueImgImmobilization);
instance?.appContext.app.component('vue-signal-monitoring', VueSignalMonitoring); instance?.appContext.app.component('vue-signal-monitoring', VueSignalMonitoring);
instance?.appContext.app.component('vue-characters', VueCharacters);
// instance?.appContext.app.component('vue-my-grade-gauge', VueGradeGauge); // instance?.appContext.app.component('vue-my-grade-gauge', VueGradeGauge);
@ -181,6 +183,52 @@ leftAsideStore.registerConfig('vue四遥组件', [
thumbnail: '/svgs/info.svg', thumbnail: '/svgs/info.svg',
props: {} props: {}
}, },
{
id: 'vue-characters',
title: '遥信文字',
type: 'vue',
thumbnail: '/svgs/info.svg',
props: {
moduleType: {
type: 'inputTypeTag',
val: '遥信',
title: '四遥类型'
},
moduleId: {
type: 'inputSelectId',
val: '',
title: '绑定ID'
},
showInfo: {
type: 'switch',
val: true,
title: '显示详情'
},
location: {
type: 'select',
val: 'bottom',
title: '名称位置',
options: [
{
value: 'top',
label: '上'
},
{
value: 'bottom',
label: '下'
},
{
value: 'left',
label: '左'
},
{
value: 'right',
label: '右'
}
]
}
}
},
{ {
id: 'vue-my-signal-gaudy', id: 'vue-my-signal-gaudy',
title: 'vue遥信02', title: 'vue遥信02',

@ -0,0 +1,79 @@
<template>
<div class="vue-characters"></div>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue';
import { useNodeByModelsStore } from '@/components/mt-edit/store/nodeByModels';
const nodeByModelsStore = useNodeByModelsStore();
const double = ref(-1);
const boolean = ref(false);
const alarms = ref(false);
const text = ref('正常');
const props = defineProps({
moduleType: {
type: String,
default: '--'
},
moduleId: {
type: String,
default: '--'
},
definitionItemJson: {
type: Object,
default: () => ({})
},
location: {
type: String,
default: 'bottom'
}
});
const getSting = (data: any) => {
};
function getModuleById(moduleId: string) {
const globalData = (window as any).globalData;
if (!globalData || moduleId == undefined || moduleId == '' || props.moduleId == '--') {
console.warn('globalData 未初始化');
return null;
}
// 访
if (globalData instanceof Map) {
// Map
return globalData.get(moduleId);
} else {
//
return globalData[moduleId];
}
}
function loadingModuleById() {
let module = getModuleById(props.moduleId);
if (props.moduleId !== '' && props.moduleId !== undefined && props.moduleId !== '--' && module) {
if (module) {
console.log('当前的module', module);
double.value = module.double;
boolean.value = module.double;
getSting({
double: double.value,
boolean: boolean.value,
alarms: alarms.value,
...module
});
}
}
}
watch(
() => props.moduleId,
(newVal, oldVal) => {
loadingModuleById();
nodeByModelsStore.change(newVal, oldVal, props.definitionItemJson.id);
}
);
</script>
<style scoped>
.vue-characters {
width: 100%;
height: 100%;
}
</style>

@ -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,176 @@
import { dayjs } from 'element-plus';
interface RecIn{
Node: {
InTypeIn: [number, string][],
TypeBase: [number, string][],
},
CONST: {
STR: {
EnumType: [number, string][]
},
UserPage:[string, string][]
},
EnumTypeVal: [number, string][][],
EnumTypeValFun: Function[],
regex: any,
trans: (val: any, enumArr: [number, string][])=> string
}
const Rec: Partial<RecIn>={};
Rec.Node={} as RecIn['Node'];
Rec.CONST={} as RecIn['CONST'];
Rec.trans = (index, type)=> {
for (let i = 0; i < type.length; i++) {
if (type[i][0] == index) {
return type[i][1];
}
}
return "*未知*";
};
// 所有输入类型
Rec.Node.InTypeIn = [
[1, '遥信'],
[2, '遥测']
];
// 四遥基本类型
Rec.Node.TypeBase = [
[1, '遥信'],
[2, '遥测'],
[3, '遥控'],
[4, '遥调'],
];
// 定值转化的 类型
Rec.CONST.STR.EnumType = [
[0, '缺省'],
[1, '普通开关'],
[2, '数值'],
[3, '时间秒'],
[11, 'RY空调模式'],
[12, '空调温度'],
[13, '空调风速'],
[14, '国网空调模式'],
[21, 'KTC空调']
];
Rec.EnumTypeVal = []; // 定值类型,用于编辑时的选择
Rec.EnumTypeValFun = []; // 转换函数,用于显示与控制
// 缺省
Rec.EnumTypeVal[0] = [
[0, '关闭'],
[1, '开启']
];
Rec.EnumTypeValFun[0] = function (val:any) {
return Rec.trans!(val, Rec.EnumTypeVal![0])
}
// 遥控
Rec.EnumTypeVal[1] = [
[0, '关闭'],
[1, '开启']
];
Rec.EnumTypeValFun[1] = function (val:any) {
return Rec.trans!(val, Rec.EnumTypeVal![1])
}
// 数值
Rec.EnumTypeVal[2] = [];
Rec.EnumTypeValFun[2] = function (val:any) {
return [];
}
// timestamp 转换成时间
Rec.EnumTypeValFun[3] = function (val:any) {
// Ext.Date.format(val * 1000, 'Y-m-d H:i:s')
dayjs.unix(val).format('YYYY-MM-DD HH:mm:ss')
}
// 国网空调模式
Rec.EnumTypeVal[14] = [
[4, '自动'],
[0, '制冷'],
[1, '制热'],
[3, '除湿'],
[2, '送风']
];
Rec.EnumTypeValFun[14] = function (val:any) {
return Rec.trans!(val, Rec.EnumTypeVal![14])
}
// RY空调模式
Rec.EnumTypeVal[11] = [
[0, '自动'],
[1, '制冷'],
[2, '制热'],
[3, '除湿'],
[4, '送风']
];
Rec.EnumTypeValFun[11] = function (val:any) {
return Rec.trans!(val, Rec.EnumTypeVal![11])
}
// 空调温度
Rec.EnumTypeVal[12] = [
[16, '16℃'],
[17, '17℃'],
[18, '18℃'],
[19, '19℃'],
[20, '20℃'],
[21, '21℃'],
[22, '22℃'],
[23, '23℃'],
[24, '24℃'],
[25, '25℃'],
[26, '26℃'],
[27, '27℃'],
[28, '28℃'],
[29, '29℃'],
[30, '30℃']
];
Rec.EnumTypeValFun[12] = function (val:any) {
return Rec.trans!(val, Rec.EnumTypeVal![12])
}
// 空调风速
Rec.EnumTypeVal[13] = [
[0, '自动'],
[1, '低'],
[2, '中'],
[3, '高']
];
Rec.EnumTypeValFun[13] = function (val:any) {
return Rec.trans!(val, Rec.EnumTypeVal![13])
}
// KTC 空调
Rec.EnumTypeVal[21] = [
[0, '关闭'],
[1, '制冷'],
[2, '制热']
];
Rec.EnumTypeValFun[21] = function (val:any) {
return Rec.trans!(val, Rec.EnumTypeVal![21])
}
// 用户的缺省界面
Rec.CONST.UserPage = [
['Admin', 'Admin'],
['User', 'User'],
]
// 正则表达式
Rec.regex = {
// Modbus 配置的正则表达式
modbusCfg: /^(?:25[0-4]|2[0-4]\d|1\d{2}|[1-9]\d|[1-9]):(?:[1-6]|10):(?:6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|[1-5]\d{4}|[1-9]\d{0,3}|0)(?::[2-9])?$/,
modbusParm: /^(?:\d+(?::\d+){0,2})?$/
}
Loading…
Cancel
Save