修复CAM和CAE模块切换错误
This commit is contained in:
parent
ecae5dca40
commit
fc26212ddd
@ -50,7 +50,16 @@ export struct SwitchModelBtn {
|
|||||||
build() {
|
build() {
|
||||||
Column({ space: 2 }) {
|
Column({ space: 2 }) {
|
||||||
if (this.eventBtn != undefined) {
|
if (this.eventBtn != undefined) {
|
||||||
EventBtn({eventBtn:this.eventBtn}).onClick(() => {
|
Button()
|
||||||
|
.width('35vp')
|
||||||
|
.height('35vp')
|
||||||
|
.backgroundImage($r('app.media.' + this.eventBtn.eIcon))
|
||||||
|
.backgroundImagePosition({ x: '10%', y: '10%' })
|
||||||
|
.backgroundColor(Color.Transparent)
|
||||||
|
.backgroundImageSize({
|
||||||
|
width: '80%', // 图片宽度占满按钮
|
||||||
|
height: '80%' // 图片高度占满按钮
|
||||||
|
}).onClick(() => {
|
||||||
if (this.eventBtn?.eEvent == 'Switch_Model_CAD') {
|
if (this.eventBtn?.eEvent == 'Switch_Model_CAD') {
|
||||||
this.curtModel = TitleData.mModels.get(1)
|
this.curtModel = TitleData.mModels.get(1)
|
||||||
} else if (this.eventBtn?.eEvent == 'Switch_Model_CAM') {
|
} else if (this.eventBtn?.eEvent == 'Switch_Model_CAM') {
|
||||||
@ -59,6 +68,11 @@ export struct SwitchModelBtn {
|
|||||||
this.curtModel = TitleData.mModels.get(3)
|
this.curtModel = TitleData.mModels.get(3)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Text(this.eventBtn.eName)
|
||||||
|
.fontSize('10fp')
|
||||||
|
.width('45vp')
|
||||||
|
.height('10vp')
|
||||||
|
.textAlign(TextAlign.Center)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.height('50vp')
|
.height('50vp')
|
||||||
|
|||||||
@ -8,22 +8,43 @@ import { TitleButton } from "../Interface/ButtonInterface";
|
|||||||
|
|
||||||
export let TitleCAE:Array<TitleModel>=[
|
export let TitleCAE:Array<TitleModel>=[
|
||||||
TitleMainPage[0],
|
TitleMainPage[0],
|
||||||
{cmName:'加工',cmPage:'',cmTips:'',cmEvents: [
|
{cmName:'仿真',cmPage:'',cmTips:'',cmEvents: [
|
||||||
//数组表示非单个BtnEvent
|
//数组表示非单个BtnEvent
|
||||||
[
|
[
|
||||||
//数组成员区别是GroupEvent还是BtnEvent
|
//数组成员区别是GroupEvent还是BtnEvent
|
||||||
[{grpName:'加工环境',grpBtn:[
|
[{grpName:'初始化仿真',grpBtn:[
|
||||||
{eModel:[ModelType.BASE],eName:"重置环境",eNamed:"",eIcon:"base_new_file",eTips:"",eEvent:""},
|
{eModel:[ModelType.BASE],eName:"导入模型",eNamed:"",eIcon:"base_new_file",eTips:"",eEvent:""},
|
||||||
{eModel:[ModelType.BASE],eName:"工艺",eNamed:"",eIcon:"base_open_file",eTips:"",eEvent:""},
|
{eModel:[ModelType.BASE],eName:"导出模型",eNamed:"",eIcon:"base_new_file",eTips:"",eEvent:""},
|
||||||
|
{eModel:[ModelType.BASE],eName:"设定仿真环境",eNamed:"",eIcon:"base_open_file",eTips:"",eEvent:""},
|
||||||
[
|
[
|
||||||
{eModel:[ModelType.BASE],eName:"切削参数",eNamed:"",eIcon:"base_save_file",eTips:"",eEvent:""},
|
{eModel:[ModelType.BASE],eName:"环境参数",eNamed:"",eIcon:"base_save_file",eTips:"",eEvent:""},
|
||||||
{eModel:[ModelType.BASE],eName:"切削速度",eNamed:"",eIcon:"base_saveas_file",eTips:"",eEvent:""},
|
{eModel:[ModelType.BASE],eName:"力学参数",eNamed:"",eIcon:"base_saveas_file",eTips:"",eEvent:""},
|
||||||
{eModel:[ModelType.BASE],eName:"主轴参数",eNamed:"",eIcon:"base_saveall_file",eTips:"",eEvent:""},
|
{eModel:[ModelType.BASE],eName:"化学参数",eNamed:"",eIcon:"base_saveall_file",eTips:"",eEvent:""},
|
||||||
] as Array<TitleButton>,
|
] as Array<TitleButton>,
|
||||||
{eModel:[ModelType.BASE],eName:"显示刀路",eNamed:"",eIcon:"base_close_file",eTips:"",eEvent:""},
|
|
||||||
{eModel:[ModelType.BASE],eName:"新建工序",eNamed:"",eIcon:"base_import_file",eTips:"",eEvent:""},
|
|
||||||
{eModel:[ModelType.BASE],eName:"新建刀具",eNamed:"",eIcon:"base_export_file",eTips:"",eEvent:""},
|
|
||||||
{eModel:[ModelType.BASE],eName:"选项",eNamed:"",eIcon:"base_open_file",eTips:"",eEvent:""},
|
{eModel:[ModelType.BASE],eName:"选项",eNamed:"",eIcon:"base_open_file",eTips:"",eEvent:""},
|
||||||
|
{eModel:[ModelType.BASE],eName:"帮助",eNamed:"",eIcon:"base_help_file",eTips:"",eEvent:""},
|
||||||
|
],grpMenu:GroupOption}] as Array<TitleGroup>
|
||||||
|
]
|
||||||
|
]},
|
||||||
|
MatrixModel,
|
||||||
|
DevModel
|
||||||
|
]
|
||||||
|
export let TitleCAM:Array<TitleModel>=[TitleMainPage[0],
|
||||||
|
{cmName:'仿真',cmPage:'',cmTips:'',cmEvents: [
|
||||||
|
//数组表示非单个BtnEvent
|
||||||
|
[
|
||||||
|
//数组成员区别是GroupEvent还是BtnEvent
|
||||||
|
[{grpName:'初始化仿真',grpBtn:[
|
||||||
|
{eModel:[ModelType.BASE],eName:"导入模型",eNamed:"",eIcon:"base_new_file",eTips:"",eEvent:""},
|
||||||
|
{eModel:[ModelType.BASE],eName:"导出模型",eNamed:"",eIcon:"base_new_file",eTips:"",eEvent:""},
|
||||||
|
{eModel:[ModelType.BASE],eName:"设定仿真环境",eNamed:"",eIcon:"base_open_file",eTips:"",eEvent:""},
|
||||||
|
[
|
||||||
|
{eModel:[ModelType.BASE],eName:"环境参数",eNamed:"",eIcon:"base_save_file",eTips:"",eEvent:""},
|
||||||
|
{eModel:[ModelType.BASE],eName:"力学参数",eNamed:"",eIcon:"base_saveas_file",eTips:"",eEvent:""},
|
||||||
|
{eModel:[ModelType.BASE],eName:"化学参数",eNamed:"",eIcon:"base_saveall_file",eTips:"",eEvent:""},
|
||||||
|
] as Array<TitleButton>,
|
||||||
|
{eModel:[ModelType.BASE],eName:"选项",eNamed:"",eIcon:"base_open_file",eTips:"",eEvent:""},
|
||||||
|
{eModel:[ModelType.BASE],eName:"帮助",eNamed:"",eIcon:"base_help_file",eTips:"",eEvent:""},
|
||||||
],grpMenu:GroupOption}] as Array<TitleGroup>
|
],grpMenu:GroupOption}] as Array<TitleGroup>
|
||||||
]
|
]
|
||||||
]},
|
]},
|
||||||
|
|||||||
@ -6,22 +6,24 @@ import { TitleGroup } from "../Interface/GroupInterface";
|
|||||||
import { MatrixModel,DevModel } from "./MatrixModel";
|
import { MatrixModel,DevModel } from "./MatrixModel";
|
||||||
import { TitleButton } from "../Interface/ButtonInterface";
|
import { TitleButton } from "../Interface/ButtonInterface";
|
||||||
|
|
||||||
export let TitleCAM:Array<TitleModel>=[TitleMainPage[0],
|
export let TitleCAM:Array<TitleModel>=[
|
||||||
{cmName:'仿真',cmPage:'',cmTips:'',cmEvents: [
|
TitleMainPage[0],
|
||||||
|
{cmName:'加工',cmPage:'',cmTips:'',cmEvents: [
|
||||||
//数组表示非单个BtnEvent
|
//数组表示非单个BtnEvent
|
||||||
[
|
[
|
||||||
//数组成员区别是GroupEvent还是BtnEvent
|
//数组成员区别是GroupEvent还是BtnEvent
|
||||||
[{grpName:'初始化仿真',grpBtn:[
|
[{grpName:'加工环境',grpBtn:[
|
||||||
{eModel:[ModelType.BASE],eName:"导入模型",eNamed:"",eIcon:"base_new_file",eTips:"",eEvent:""},
|
{eModel:[ModelType.BASE],eName:"重置环境",eNamed:"",eIcon:"base_new_file",eTips:"",eEvent:""},
|
||||||
{eModel:[ModelType.BASE],eName:"导出模型",eNamed:"",eIcon:"base_new_file",eTips:"",eEvent:""},
|
{eModel:[ModelType.BASE],eName:"工艺",eNamed:"",eIcon:"base_open_file",eTips:"",eEvent:""},
|
||||||
{eModel:[ModelType.BASE],eName:"设定仿真环境",eNamed:"",eIcon:"base_open_file",eTips:"",eEvent:""},
|
|
||||||
[
|
[
|
||||||
{eModel:[ModelType.BASE],eName:"环境参数",eNamed:"",eIcon:"base_save_file",eTips:"",eEvent:""},
|
{eModel:[ModelType.BASE],eName:"切削参数",eNamed:"",eIcon:"base_save_file",eTips:"",eEvent:""},
|
||||||
{eModel:[ModelType.BASE],eName:"力学参数",eNamed:"",eIcon:"base_saveas_file",eTips:"",eEvent:""},
|
{eModel:[ModelType.BASE],eName:"切削速度",eNamed:"",eIcon:"base_saveas_file",eTips:"",eEvent:""},
|
||||||
{eModel:[ModelType.BASE],eName:"化学参数",eNamed:"",eIcon:"base_saveall_file",eTips:"",eEvent:""},
|
{eModel:[ModelType.BASE],eName:"主轴参数",eNamed:"",eIcon:"base_saveall_file",eTips:"",eEvent:""},
|
||||||
] as Array<TitleButton>,
|
] as Array<TitleButton>,
|
||||||
|
{eModel:[ModelType.BASE],eName:"显示刀路",eNamed:"",eIcon:"base_close_file",eTips:"",eEvent:""},
|
||||||
|
{eModel:[ModelType.BASE],eName:"新建工序",eNamed:"",eIcon:"base_import_file",eTips:"",eEvent:""},
|
||||||
|
{eModel:[ModelType.BASE],eName:"新建刀具",eNamed:"",eIcon:"base_export_file",eTips:"",eEvent:""},
|
||||||
{eModel:[ModelType.BASE],eName:"选项",eNamed:"",eIcon:"base_open_file",eTips:"",eEvent:""},
|
{eModel:[ModelType.BASE],eName:"选项",eNamed:"",eIcon:"base_open_file",eTips:"",eEvent:""},
|
||||||
{eModel:[ModelType.BASE],eName:"帮助",eNamed:"",eIcon:"base_help_file",eTips:"",eEvent:""},
|
|
||||||
],grpMenu:GroupOption}] as Array<TitleGroup>
|
],grpMenu:GroupOption}] as Array<TitleGroup>
|
||||||
]
|
]
|
||||||
]},
|
]},
|
||||||
|
|||||||
@ -18,7 +18,7 @@ export struct TitleTab {
|
|||||||
//TabBar默认焦点
|
//TabBar默认焦点
|
||||||
@Local titleBarDefaultFocusIndex: number = 0;
|
@Local titleBarDefaultFocusIndex: number = 0;
|
||||||
//模块Bar栏
|
//模块Bar栏
|
||||||
@Provider('curtModel') curtModel:Array<TitleModel>|undefined= TitleData.mModels.get(0)
|
@Provider('curtModel') curtModel:Array<TitleModel>|undefined= TitleData.mModels.get(this.titleBarFocusIndex)
|
||||||
@Builder
|
@Builder
|
||||||
FileMenu(menus: Array<TitleButton>) {
|
FileMenu(menus: Array<TitleButton>) {
|
||||||
Menu() {
|
Menu() {
|
||||||
@ -69,7 +69,7 @@ export struct TitleTab {
|
|||||||
Tabs({barPosition: BarPosition.Start, index: this.titleBarDefaultFocusIndex,controller: this.titleBarTabs}){
|
Tabs({barPosition: BarPosition.Start, index: this.titleBarDefaultFocusIndex,controller: this.titleBarTabs}){
|
||||||
ForEach(this.curtModel,(item:TitleModel, index: number)=>{
|
ForEach(this.curtModel,(item:TitleModel, index: number)=>{
|
||||||
TabContent() {
|
TabContent() {
|
||||||
TitleTabContent({tabLayout:item.cmEvents as Array<Array<TitleButton|Array<TitleGroup>|Array<TitleButton>>>})
|
TitleTabContent({curtLayout:item})
|
||||||
}.align(Alignment.Start)
|
}.align(Alignment.Start)
|
||||||
.padding(1)
|
.padding(1)
|
||||||
.margin({ top: 0,left:0,bottom:2,right:0})
|
.margin({ top: 0,left:0,bottom:2,right:0})
|
||||||
|
|||||||
@ -3,37 +3,52 @@ import { TitleButton} from '../LayoutInterface/Interface/ButtonInterface';
|
|||||||
import { TitleGroup} from '../LayoutInterface/Interface/GroupInterface';
|
import { TitleGroup} from '../LayoutInterface/Interface/GroupInterface';
|
||||||
import {GroupTextEventMenu,MenuBtn} from '../CustomStyle/Menu'
|
import {GroupTextEventMenu,MenuBtn} from '../CustomStyle/Menu'
|
||||||
import {EventBtn,SwitchModelBtn} from '../CustomStyle/Button'
|
import {EventBtn,SwitchModelBtn} from '../CustomStyle/Button'
|
||||||
|
import { TitleModel } from '../LayoutInterface/Layout/TabContent';
|
||||||
|
|
||||||
@ComponentV2
|
@ComponentV2
|
||||||
export struct TitleTabContent {
|
export struct TitleTabContent {
|
||||||
@Param tabLayout:Array<Array<TitleButton|Array<TitleGroup>|Array<TitleButton>>>=[];
|
@Param curtLayout:TitleModel|undefined=undefined;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
BtnMenu(item:Array<TitleButton>){
|
||||||
|
MenuBtn({menuBtn:item})
|
||||||
|
}
|
||||||
|
@Builder
|
||||||
|
BtnEvent(item: TitleButton){
|
||||||
|
EventBtn({eventBtn:item})
|
||||||
|
}
|
||||||
|
@Builder
|
||||||
|
BtnSwitchMode(item: TitleButton){
|
||||||
|
SwitchModelBtn({eventBtn:item})
|
||||||
|
}
|
||||||
build() {
|
build() {
|
||||||
//垂直布局展示多行
|
//垂直布局展示多行
|
||||||
Column({ space: 0 }) {
|
Column({ space: 0 }) {
|
||||||
//迭代生成行容器
|
//迭代生成行容器
|
||||||
ForEach(this.tabLayout, (row_items: Array<TitleButton|Array<TitleGroup>|Array<TitleButton>>, mIndex: number) => {
|
ForEach(this.curtLayout?.cmEvents, (row_items: Array<TitleButton|Array<TitleGroup>|Array<TitleButton>>, mIndex: number) => {
|
||||||
//行的按钮组容器
|
//行的按钮组容器
|
||||||
Row(){
|
Row(){
|
||||||
ForEach(row_items, (row_item: TitleButton|Array<TitleGroup>|Array<TitleButton>, index: number) => {
|
ForEach(row_items, (row_item: TitleButton|Array<TitleGroup>|Array<TitleButton>, index: number) => {
|
||||||
//首先判断是否为数组.如果不为数组者为BtnEvent
|
if(!Array.isArray(row_item)){//TitleButton
|
||||||
if(!Array.isArray(row_item)){
|
|
||||||
//单按钮
|
//单按钮
|
||||||
EventBtn({eventBtn:row_item})
|
EventBtn({eventBtn:row_item})
|
||||||
}else if(row_item instanceof Array<TitleGroup>){
|
}else if(row_item instanceof Array<TitleGroup>){ //Array<TitleGroup>
|
||||||
//功能组,迭代多个功能组
|
//功能组,迭代多个功能组
|
||||||
ForEach(row_item, (group_item: TitleGroup, index: number) =>{
|
ForEach(row_item, (group_item: TitleGroup, index: number) =>{
|
||||||
Column({ space: 5 }){
|
Column({ space: 5 }){
|
||||||
Row({ space: 1 }){
|
Row({ space: 1 }){
|
||||||
ForEach(group_item.grpBtn, (btn_item: TitleButton|Array<TitleButton>, index: number) =>{
|
ForEach(group_item.grpBtn, (btn_item: TitleButton|Array<TitleButton>, index: number) =>{
|
||||||
//如果是数组则为菜单按钮否则为单功能按钮
|
if(this.curtLayout?.cmName=='应用模块'){
|
||||||
if(Array.isArray(btn_item)){
|
if(Array.isArray(btn_item)){
|
||||||
MenuBtn({menuBtn:btn_item})
|
this.BtnMenu(btn_item)
|
||||||
}else{
|
|
||||||
//针对最后一个Bar特化处理.如果为最后一个Bar则在子组件Image真假onClick事件
|
|
||||||
if(mIndex==this.tabLayout.length-2){
|
|
||||||
SwitchModelBtn({eventBtn:btn_item})
|
|
||||||
}else{
|
}else{
|
||||||
EventBtn({eventBtn:btn_item})
|
this.BtnSwitchMode(btn_item)
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(Array.isArray(btn_item)){
|
||||||
|
this.BtnMenu(btn_item)
|
||||||
|
}else{
|
||||||
|
this.BtnEvent(btn_item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user