Files
fc/dev/project/assets/Scripts/zbridge/utils/bridge.cmd.js
T
2026-05-23 22:10:14 +08:00

57 lines
1.2 KiB
JavaScript

// ================================================================
//
// 桥接 简单命令机制
//
// ================================================================
// 导出
module.exports = {
// 执行命令
doStr: function( _cmd ) {
if( nx.dt.strEmpty( _cmd ) ) {
nx.error( "$Cmd:无效空命令!" );
return;
}
let args = _cmd.split( "&" );
return this.doArgs( args.shift(), ...args );
},
// 执行命令
doArgs: function( _key, ...args ) {
nx.debug( "$Cmd:执行命令:", _key, ...args );
switch( _key ) {
// 功能/窗体跳转
case "jump":
return this.doJump( ...args );
default: break;
}
nx.error( "$Cmd:无效命令:", _key );
return false;
},
// 功能/窗体跳转
doJump: function( _key, _p1, _p2 ) {
let args = { p1: _p1, p2: _p2 };
// 功能编号
let id = parseInt( _key );
if( nx.dt.numPositive( id, false ) ) {
nx.bridge.jumper.jump2Window( id, args );
} else {
// 打开窗体
nx.bridge.createPanel( _key, args );
}
return true;
},
}