From c303d5e79f4a9e926ca35d9fedbe98114c1827a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=94=BF?= <3443290081@qq.com> Date: Thu, 26 Mar 2026 09:55:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/config.ts | 48 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/src/utils/config.ts b/src/utils/config.ts index f0a4fef..010dc07 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -9,6 +9,9 @@ interface RecIn{ STR: { EnumType: [number, string][] }, + YX: { + EnumType: [number, string][] + }, UserPage:[string, string][] }, EnumTypeVal: [number, string][][], @@ -33,7 +36,17 @@ Rec.Node.InTypeIn = [ [1, '遥信'], [2, '遥测'] ]; - +const getIndex=(num:number)=>{ + switch (num) + { + case 1 : + return 100 + case 2 : + return 0 + default: + return -1 + } +} // 四遥基本类型 Rec.Node.TypeBase = [ [1, '遥信'], @@ -54,19 +67,37 @@ Rec.CONST.STR.EnumType = [ [14, '国网空调模式'], [21, 'KTC空调'] ]; +Rec.CONST.YX.EnumType=[ + [0, '颜色'], + [1, '文字'], + [2, '颜色+文字'], +] + Rec.EnumTypeVal = []; // 定值类型,用于编辑时的选择 Rec.EnumTypeValFun = []; // 转换函数,用于显示与控制 + +Rec.EnumTypeVal[100] = [ + [0, '绿色'], + [1, '黄色'], + [2, '红色'], +]; +Rec.EnumTypeVal[101] = [ + [0, '开启'], + [1, '关闭'], + [2, ''], +]; // 缺省 Rec.EnumTypeVal[0] = [ [0, '关闭'], [1, '开启'] ]; -Rec.EnumTypeValFun[0] = function (val:any) { - return Rec.trans!(val, Rec.EnumTypeVal![0]) +Rec.EnumTypeValFun[0] = function (val:any,index:number) { + return Rec.trans!(val, Rec.EnumTypeVal![index+0]) } +//Rec.EnumTypeValFun[0](val,getIndex(btype)); // 遥控 Rec.EnumTypeVal[1] = [ @@ -74,14 +105,14 @@ Rec.EnumTypeVal[1] = [ [1, '开启'] ]; -Rec.EnumTypeValFun[1] = function (val:any) { - return Rec.trans!(val, Rec.EnumTypeVal![1]) +Rec.EnumTypeValFun[1] = function (val:any,index:number) { + return Rec.trans!(val, Rec.EnumTypeVal![index+1]) } // 数值 Rec.EnumTypeVal[2] = []; -Rec.EnumTypeValFun[2] = function (val:any) { - return []; +Rec.EnumTypeValFun[2] = function (val:any,index:number) { + return Rec.trans!(val, Rec.EnumTypeVal![index+2]); } // timestamp 转换成时间 @@ -161,7 +192,8 @@ Rec.EnumTypeVal[21] = [ Rec.EnumTypeValFun[21] = function (val:any) { return Rec.trans!(val, Rec.EnumTypeVal![21]) } - +// +Rec.EnumTypeValFun[21]() // 用户的缺省界面 Rec.CONST.UserPage = [ ['Admin', 'Admin'],